Re: *p++ = tolower(*p));
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Sat, 31 Mar 2007 06:24:59 +0000
Dave Vandervies said:
In article <PdadnarcgZhod5HbnZ2dnUVZ8vydnZ2d@xxxxxx>,
Richard Heathfield <rjh@xxxxxxxxxxxxxxx> wrote:
Gunvant Patil said:
*p++ = tolower(*p));
is this behaviour defined in standards?
I took one look at it and immediately knew the answer. "No... er, hmm,
sequence points, so yes... er, hang on, er, what if..., hmm..." which
is always a good hint that it's better to re-write it to reflect what
you actually mean (which isn't clear from the code).
tolower is explicitly permitted to be, and typically is, implemented
as a macro that masks the function definition, isn't it?
Such considerations were certainly a factor in my "hang on, er, what
if". But if the choice is between, on the one hand, spending an hour
proving it from the Standard and, on the other, spending a few seconds
saying "don't be silly" and using the rest of the time to cut code,
then it's simply no contest.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
.
- References:
- *p++ = tolower(*p));
- From: Gunvant Patil
- Re: *p++ = tolower(*p));
- From: Richard Heathfield
- Re: *p++ = tolower(*p));
- From: Dave Vandervies
- *p++ = tolower(*p));
- Prev by Date: Re: About Union's question
- Next by Date: Re: Is it a good thing that program mix C and C++?
- Previous by thread: Re: *p++ = tolower(*p));
- Next by thread: Re: *p++ = tolower(*p));
- Index(es):
Relevant Pages
|