Re: Which is faster?
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Fri, 01 Aug 2008 11:42:50 +0000
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
.
- Follow-Ups:
- Re: Which is faster?
- From: Ali Karaali
- Re: Which is faster?
- References:
- Re: Which is faster?
- From: pete
- Re: Which is faster?
- Prev by Date: Re: rounding of 4 unsigned char numbers
- Next by Date: Re: Why do you like C more than other programming languages?
- Previous by thread: Re: Which is faster?
- Next by thread: Re: Which is faster?
- Index(es):
Relevant Pages
|