HI! Glynn

MActually i wanted to find out if gcc parsed the string right to left.

'cos someone told me k&r c did this left to right.

isn't this a violation of the ru;le in k&r c .

secodnly in fork, -1 rmeans an error  no -ve value.

so wo my qs. again, why 0 ?



On Wed, 28 Apr 1999, Glynn Clements wrote:

> 
> Amol Mohite wrote:
> 
> > In gcc,
> > 
> > if i = 2;
> > then j = i++ + ++i;
> > 
> >     what is the value of j.
> 
>       i++ == 2
>       ++i == 3
> =>    j   == 5
> 
> > what is the calling sequence in this case ? ++i first or i++ first ?
> 
> ++i; i++ will increment i after the expression has been evaluated.
> 
> > why does fork have to return a value of zero to the child process ?
> 
> Because it does. fork() has to indicate whether the processes is the
> parent or the child. It also has to return the child's pid to the
> parent (there isn't any other way for the parent to obtain this
> information). The child can just use getppid() to find the pid of its
> parent.
> 
> > why not -5 or -6 ?
> 
> What would a negative return value signify? (currently a negative
> result signifies an error, which is the standard convention for
> functions which normally return a nonnegative integer when
> successful).
> 
> -- 
> Glynn Clements <[EMAIL PROTECTED]>
> 

Reply via email to