Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: PerlIO::Layers 0.011 fails to build in macOS 10.13.3

by bliako (Monsignor)
on Mar 28, 2018 at 21:35 UTC ( [id://1211946]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1211946]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-04-16 07:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found