Re: void pointer



On 2 Oct, 10:45, Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
Nick Keighley said:

Is this a strictly conforming program?

int main (void)
{
    int fortran = 1;
    int asm = 2;
    return 0;
}

Yes.

if it is then certain common extensions will break it.

Not necessarily. An implementation that offers fortran and asm as keywords
might nevertheless be "bright" enough to recognise such situations and
deal with them appropriately.

I think your "bright enough" compiler would be a candidate for
passing
the Turing test.

typedef long fortran

fortran int big_math_calculation (void)
{
C IT'S A LONG TIME SINCE I WROTE ANY FORTRAN

FOR I = 1 TO 100000 DO
J = 99 ** 99

RETURN J
}

so does that function return long int? It's harder to craft an asm
example. Ah!

typedef int load;

int main(void)
{
int i;
asm (load i);
return 0;
}

Hmm. asm seems to need a character string literal. That makes things
easier:-

int main(void)
{
asm ("refrog z-reg;");
}

You seem to be taking the opposite stance from the thread
that argues

void main(void)
{
    return 0;
}

is "correct"

not that taking different sides in an argument is wrong
(I'm descended from lawyers, so I would say that).

(presumably for small values of correct)

Vanishingly small, and I don't think we have a sufficiently powerful
microscope.

Oh I agree! It seemed to involve defining "correct" as "wrong"
and "mandatory" as "optional". A career in marketing seems certain.


--
Nick Keighley
.



Relevant Pages