On Wed, Nov 06, 2002 at 11:54:17AM -0500, John Baldwin wrote:
> 
> On 06-Nov-2002 Marc Olzheim wrote:
> > ..
> > if ((nd = parse_char_class(++nd)) == NULL) {
> > ..
> > 
> > Hmmm... is this legal ?
> > 
> > http://www.eskimo.com/~scs/C-faq/q3.1.html seems to tell otherwise...
> 
> If it were nd++, yes.  However, it is ++nd, thus, the increment
> happens first, then the call to parse_char_class(), then the assignment
> to nd.  It might be clearer to rewrite this like so however:

In this regard nd++ and ++nd are completely equivalent. If parse_char_class
is a function (and not a macro) I think the expression might be legal
anyway since there is a sequence point after evaluating the arguments for
a function call and making the call. 
If, OTOH, parse_char_class is a macro then the above expression is
definitely not legal.
(It is not legal to modify an object more than once without a sequence
point in between.)


> 
>   if ((nd = parse_char_class(nd + 1)) == NULL) {
> 
> Since that is effectively what it is doing.

Yes, that would be clearer and definitely legal.


-- 
<Insert your favourite quote here.>
Erik Trulsson
[EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to