tech-kern archive

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

Re: Some kernel void functions do return a value

On Sun 16 Oct 2011 at 00:52:35 +0100, Mindaugas Rasiukevicius wrote:
> David Young <> wrote:
> > This isn't just a lint bug?  At least two of these are instances of void
> > functions returning the return "value" of a void function, for which
> > the compiler need neither throw away a value nor create one from whole
> > nothing.  The compiler doesn't complain---should it?  For example:
> It has no harm, but C standard does not permit return with an expression
> for void functions.  Compiler throws a warning with -std=c99.

Once upon a time, when I was playing with a C compiler, I extended it to
have "values" of type void, including variables. In that variant, you
could do what David describes. Of course you could not use void values,
only pass them around, which did nothing. But none of that is possible
in real C.

(The whole exercise started out because I was playing with arrays with 0
elements, which wasn't allowed at the time, but which were often used
for open-ended structs)

___ Olaf 'Rhialto' Seibert  -- There's no point being grown-up if you 
\X/ rhialto/at/    -- can't be childish sometimes. -The 4th Doctor

Home | Main Index | Thread Index | Old Index