[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: expressions vs. statements



Fredrik Lundh writes:
> kragen wrote:
> > The particular problem I brought up, which Pixel corroborated, is that
> > a function in Perl or C whose primary purpose is to have side effects
> > nevertheless returns a value, the value of the last expression it
> > evaluates.
> 
> is that really true for C?
> 
> don't have the specification within reach, but I'm pretty
> sure it says that the return value is *undefined*.

It isn't really true for C in general, but it's really true for some
implementations of C, including a lot of the early ones.  So it's a
problem that (I've heard but never experienced) used to come up in C
programs, especially before the introduction of 'void'.

That was sloppy of me.  Sorry.