__FILE__ macro will be concatenated to previous string accidentally in C -


this simplest example of question:

#include<stdio.h> int main() {         printf("%s:%s\n", "i in file" __file__); } 

when forget insert comma before "__file__" macro, expect compile error, warning. output be:

i in filetest.c:[c

  • 1st string : "i in file" concatenate __file__ macro
  • 2nd string undefined

could tell me why not compile error?

while possible compiler in e.g. printf , scanf (because knows format-strings functions), can't done variable-argument functions.

if create vararg function, how compiler know number of arguments correct? answer can't. therefore c specification doesn't has error.

that compilers (some, not all) give warnings printf , scanf because creators of compiler nice enough add it. it's not required.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -