Sujet : Re: Integral types and own type definitions (was Re: Suggested method for returning a string from a C program?)
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.cDate : 26. Mar 2025, 22:53:28
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vs1t0p$2m8ne$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 26.03.2025 20:38, Keith Thompson wrote:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
On 26.03.2025 12:33, David Brown wrote:
[...]
Even in C (in a desperate attempt to bring us back on topic for the
group), there are no negative integer constants - merely positive
integer constants with a unary minus operator applied.
>
Is that so? (Harmlessly asking.) - I mean, if I write int x = -5;
does it matter (in "C") whether its parsed as <integer number> or
<negation> <positive number> ?
If -5 were a single token (an integer constant), then 6-5 would be an
integer constant 6 followed by an integer constant -5, a syntax error.
This is generally not true; that depends on the syntax rules. It is
perfectly fine to have rules for 2-ary addition and subtraction and
have also negative (and positive) literals or expressions with unary
plus and minus operators.
Disclaimer: As usual I'm not speaking about any peculiarity that "C"
may (or may not) have defined in its standard, but generally.
Janis
[...]