in reply to Re^2: PerlIO::Layers 0.011 fails to build in macOS 10.13.3
in thread PerlIO::Layers 0.011 fails to build in macOS 10.13.3

with your little c-program:

gcc -DVER="0.1" -E try.c

does the preprocessor pass and expands FOO to:

printf("%s\n", "" 0.1 "")

and

gcc -DVER="\"0.1\"" -E try.c

expands it to:

printf("%s\n", "" "0.1" "")

so, whereas

printf("%s\n", 0.1)

would have caused just a warning at compile time and a crash later,

printf("%s\n", "" 0.1 "")

causes an error right away

and
printf("%s\n", "" "0.1" "")

is legitimate.

bliako

Replies are listed 'Best First'.
Re^4: PerlIO::Layers 0.011 fails to build in macOS 10.13.3
by syphilis (Archbishop) on Mar 29, 2018 at 01:07 UTC
    printf("%s\n", "" "0.1" "") didn't immediately look like valid C to me (and it's not valid perl).
    But C does allow that type of concatenation - whereas I guess perl doesn't really need to.
    Even in assignment one can do char *x = "hello" "0.01" "world";

    Cheers,
    Rob