Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #139487
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <kst-u@mib.org> |
| Newsgroups | comp.lang.c |
| Subject | Re: calling argumentless function with argument |
| Date | Sun, 06 Jan 2019 15:59:13 -0800 |
| Organization | None to speak of |
| Lines | 56 |
| Message-ID | <lno98tibhq.fsf@kst-u.example.com> (permalink) |
| References | <g99egeFi15cU1@mid.uni-berlin.de> <q0o1u7$769$1@dont-email.me> <gLMXD.21659$Fi6.17101@fx12.am4> <ce24cad6-cccf-478b-8174-66d2a6096679@googlegroups.com> <7b78af94-c61a-4d48-8785-d1d6e16e3c9b@googlegroups.com> <977706ee-c6d5-4f9a-9fbc-33710a8dac39@googlegroups.com> <a9d21dc7-c914-4517-a26f-1a218c5a4964@googlegroups.com> <4bddaa2a-c31a-4d79-ab65-69b85a71ef2c@googlegroups.com> <m2r2dqljbb.fsf@despina.home> <nBdYD.43265$Fi6.26172@fx12.am4> <87r2dqsdl4.fsf@bsb.me.uk> <4TlYD.88848$Sj4.69467@fx15.am4> <1dcff02b-a821-401e-861d-6984bbf7c5cc@googlegroups.com> <m2imz2j6dz.fsf@despina.home> <m2bm4uj66l.fsf@despina.home> <ad9a4590-0b48-4142-a8d6-b8ad09127c6b@googlegroups.com> <m27efhkem6.fsf@despina.home> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | reader01.eternal-september.org; posting-host="8aece196c9e75518dbb5186db17fe852"; logging-data="15434"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX182U/3PXWEhx85eeQwgbiXb" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
| Cancel-Lock | sha1:GAmruHog0oHMLLKbuqQEOxNLRgA= sha1:DxTNqZpxxmRxmVEdimSxXMcQpHo= |
| Xref | csiph.com comp.lang.c:139487 |
Show key headers only | View raw
"Pascal J. Bourguignon" <pjb@informatimago.com> writes:
[...]
> This is not true. Granted, it's relative to the user, but realize that
> programmers that consider that + is concatenation have a distorted view.
> + is addition for everybody. The concatenation operator is always
> denoted with some something else (ยท or ! or empty, etc).
That's not correct. C++ and Python, for example, both use "+"
for string concatenation (C++ for its std::string type, not for
C-style strings), and I'm sure there are plenty of other languages
that do the same. It's not mathematical addition, but it is a
kind of addition, in that you're "adding" a string to the end of
another string. In any case, programmers who use those languages
are, for the most part, perfectly capable of understanding that
"+" in that context doesn't mean addition.
The assignment of operator symbols to operations, both in mathematics
and in programming, is mostly arbitrary.
I suggest that what you mean is that you personally dislike using
"+" for concatenation.
> But foremost, in the case of C:
>
> 1- string + integer and integer + string already has a meaning so you
> cannot use + to mean concatenation in those cases.
That's only an issue if you want to support concatenation of strings and
integers without explicit conversion.
> 2- string-literal string-literal already means concatenation. So it
> would be much better to use empty for concatenation, than +.
> (But ! would be even better, and as binary operator it's free).
The existing syntax for string literal concatenation is unambiguous,
since two adjacent string literals don't have a different meaning.
Allowing arbitrary expressions could produce some ambiguities, and
could cause problems for typos. *If* C were to add a concatenation
operator, it should probably be a punctuation symbol. I would have
no problem using "!" for this. (Perl 6 uses "~", FWIW.)
But working out the semantics would be very difficult.
C++'s std::string is defined using the features of the language
(classes, operator overloading, implicitly invoked constructors and
destructors, etc.). If there were a way to do something similar
using C's language features, or by adding some *small* well-defined
set of features that would be of general use, I wouldn't object.
I'm just skeptical that it's practical. (Of course you could do it by
turning C into C++, but C++ already exists.)
--
Keith Thompson (The_Other_Keith) kst@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
calling argumentless function with argument jt@toerring.de (Jens Thoms Toerring) - 2019-01-04 16:04 +0000
Re: calling argumentless function with argument David Brown <david.brown@hesbynett.no> - 2019-01-04 17:34 +0100
Re: calling argumentless function with argument Bart <bc@freeuk.com> - 2019-01-04 17:30 +0000
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-04 09:50 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-05 05:58 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-05 07:56 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-05 10:56 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-05 14:55 -0800
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 01:29 +0100
Re: calling argumentless function with argument Bart <bc@freeuk.com> - 2019-01-06 02:20 +0000
Re: calling argumentless function with argument Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-06 02:51 +0000
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 12:12 +0100
Re: calling argumentless function with argument Bart <bc@freeuk.com> - 2019-01-06 11:53 +0000
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 12:58 +0100
Re: calling argumentless function with argument Bart <bc@freeuk.com> - 2019-01-06 11:45 +0000
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 12:58 +0100
Re: calling argumentless function with argument Bart <bc@freeuk.com> - 2019-01-06 12:24 +0000
Re: calling argumentless function with argument Keith Thompson <kst-u@mib.org> - 2019-01-06 04:34 -0800
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 13:41 +0100
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-06 04:10 -0800
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 13:51 +0100
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 13:56 +0100
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-06 05:20 -0800
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 16:08 +0100
Re: calling argumentless function with argument Keith Thompson <kst-u@mib.org> - 2019-01-06 15:59 -0800
Re: calling argumentless function with argument Bart <bc@freeuk.com> - 2019-01-06 13:42 +0000
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-06 06:22 -0800
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 16:19 +0100
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-06 07:42 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-06 08:05 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-06 08:30 -0800
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 17:44 +0100
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-06 08:54 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-07 08:02 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-07 08:07 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-07 09:16 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-07 09:40 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-07 09:57 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-09 02:23 -0800
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 16:17 +0100
Re: calling argumentless function with argument Bart <bc@freeuk.com> - 2019-01-06 16:56 +0000
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-06 09:12 -0800
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-06 12:39 -0800
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 18:26 +0100
Re: calling argumentless function with argument Bart <bc@freeuk.com> - 2019-01-06 18:52 +0000
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-06 02:32 -0800
Re: calling argumentless function with argument Keith Thompson <kst-u@mib.org> - 2019-01-06 04:38 -0800
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 13:42 +0100
Re: calling argumentless function with argument Robert Wessel <robertwessel2@yahoo.com> - 2019-01-06 10:27 -0600
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-06 17:47 +0100
Re: calling argumentless function with argument David Brown <david.brown@hesbynett.no> - 2019-01-04 19:30 +0100
Re: calling argumentless function with argument Keith Thompson <kst-u@mib.org> - 2019-01-04 10:55 -0800
Re: calling argumentless function with argument Robert Wessel <robertwessel2@yahoo.com> - 2019-01-05 00:16 -0600
Re: calling argumentless function with argument queequeg@trust.no1 (Queequeg) - 2019-01-07 10:43 +0000
Re: calling argumentless function with argument Robert Wessel <robertwessel2@yahoo.com> - 2019-01-07 16:25 -0600
Re: calling argumentless function with argument Barry Schwarz <schwarzb@dqel.com> - 2019-01-04 09:54 -0800
Re: calling argumentless function with argument Thiago Adams <thiago.adams@gmail.com> - 2019-01-04 10:26 -0800
Re: calling argumentless function with argument Keith Thompson <kst-u@mib.org> - 2019-01-04 12:07 -0800
Re: calling argumentless function with argument James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-01-04 15:03 -0500
Re: calling argumentless function with argument Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-05 00:04 +0000
Re: calling argumentless function with argument James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-01-05 22:36 -0500
Re: calling argumentless function with argument jt@toerring.de (Jens Thoms Toerring) - 2019-01-05 13:17 +0000
Re: calling argumentless function with argument fir <profesor.fir@gmail.com> - 2019-01-05 06:06 -0800
Re: calling argumentless function with argument David Brown <david.brown@hesbynett.no> - 2019-01-05 15:42 +0100
Re: calling argumentless function with argument Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-05 14:58 +0000
Re: calling argumentless function with argument "Pascal J. Bourguignon" <pjb@informatimago.com> - 2019-01-05 16:11 +0100
Re: calling argumentless function with argument Richard Damon <Richard@Damon-Family.org> - 2019-01-05 11:23 -0500
Re: calling argumentless function with argument Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-05 16:53 +0000
Re: calling argumentless function with argument Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-01-06 00:46 +0000
csiph-web