M
Mark McIntyre
Don is Dan's twin brother - Don got the people skills, Dan the C^
Is this a typo or a joke?
skills...
Don is Dan's twin brother - Don got the people skills, Dan the C^
Is this a typo or a joke?
Actually no. THis has nothing to do with the macros. In your code " B ;"
doesn't make sense. B has no type and is hence undefined. So when it is
replaced by A, it is still undefined.
Ben Pfaff said:I don't think that this code is undefined in C99. Check out
example 3 in C99 6.7.3.1:
printf() doesn't modify its arguments[1] so I don't think that
printf("%s", "%s"); is undefined.
Or am I missing something?
[1] Well, certainly not in this case, unless you want to argue
that one should not pass string literals to printf().
In said:Yeah, okay, that sounds right. In that case, Dan, what *was* the
issue? Or were you thinking the same way? Or was the "restrict issue"
the misdeclaration of printf()?
Or you can also tell me how it can be done on a Linux machine with all
standard development tools installed.
Thank you for this post, Ravi.
Output: 5 6.000000 0 0.000000
(There is one space before the 5.)
I don't know if it's implementation dependent.
The code that you cite from the technical skill paper is referred to
as "spaghetti code" by _The New Hacker's Dictionary_. Spaghetti code
is code with an unnecessarily complex and tangled control structure.
Ben Pfaff said:Pointless and stupid and effectively a no-op besides.
You should declare main() as explicitly returning `int'. This is
required in C99. You should also write `void' within the
parentheses to give it a prototype, though it is not required.
You should return a value from main().
It is undefined for at least two reasons: first, trying to print
out an `int' using %f; second, for failing to write a final
new-line character to stdout.
I think it aims at testing something, but it has little to do
with C skills, especially considering the stupid macro
definitions. It tests knowledge of C trivia, not knowledge of C
usage.
In said:^^^^^^^^^
Quite probably!
Few non-native English speakers are likely to get this one.
I got it and I'm a non-native English speaker. What do I win?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.