Re: Which is faster?



pete said:

<snip>

p += 1; /* a statement */

Right.

(p += 1) /* an expression */

Right.

'p += 1' /* not a c construct */

Er, wrong.

3.1.3.4 (C89): "An integer character constant is a sequence of one or more
multibyte characters enclosed in single-quotes, as in 'x' or 'ab'."

6.4.4.4(2) (C99): "An integer character constant is a sequence of one or
more multibyte characters enclosed in single-quotes, as in 'x'."

The difference between the above two quotes led me to poke around further
in C99:

6.4.4.4(10): "The value of an integer character constant containing more
than one character (e.g., 'ab'), or containing a character or escape
sequence that does not map to a single-byte execution character, is
implementation-defined."

Thus, 'p += 1' /is/ a C construct, albeit not a terribly useful one.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages

  • Re: How to delete the following file
    ... No confusion here unless you don't understand that the back-slash is an ... "escape" character, not part of the file name. ... entire name in single-quotes, then escaping the offending character (the ... The issue is that the file name commences with a dash, ...
    (RedHat)
  • Re: Which is faster?
    ... multibyte characters enclosed in single-quotes, ... in C99: ... than one character, or containing a character or escape ... sequence that does not map to a single-byte execution character, ...
    (comp.lang.c)
  • Re: Which is faster?
    ... multibyte characters enclosed in single-quotes, ... in C99: ... than one character, or containing a character or escape ... sequence that does not map to a single-byte execution character, ...
    (comp.lang.c)
  • RE: DataAdapter returns 0 results, what am I doing wrong?
    ... You might need to use the % character instead of the * character with Like: ... Also, double-quote delimiters might work, but you might need single-quotes: ... Kerry Moorman ... > (Appointments INNER JOIN Buildings ON ...
    (microsoft.public.dotnet.languages.vb)
  • Re: user defined function that converts string to float
    ... > I need user defined function that converts string to float in c. ... initial, possibly empty, sequence of white-space characters (as ... point character, then an optional exponent part as defined in ... then a nonempty sequence of hexadecimal digits ...
    (comp.lang.c)