Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
I had a frustrating problem which turned out to be caused by the line ....
I had a frustrating problem which turned out to be caused by the line
printf("%d", n);
✍: Guest
where n was actually a long int. I thought that ANSI function prototypes were supposed to guard against argument type mismatches like this.
A:When a function accepts a variable number of arguments, its prototype does not (and cannot) provide any information about the number and types of those variable arguments. Therefore, the usual protections do not apply in the variable-length part of variable-length argument lists: the compiler cannot perform implicit conversions or (in general) warn about mismatches. The programmer must make sure that arguments match, or must manually insert explicit casts.
In the case of printf-like functions, some compilers (including gcc) and some versions of lint are able to check the actual arguments against the format string, as long as the format string is an immediate string literal.
2016-01-11, 1095👍, 0💬
Popular Posts:
What is triple constraint triangle in project management ? Project Management triangle is depicted a...
How do we host a WCF service in IIS? Note: - The best to know how to host a WCF in IIS is by doing a...
What is shadowing ? When two elements in a program have same name, one of them can hide and shadow t...
How To Enter a New Row into a Table Interactively? - Oracle DBA FAQ - Introduction to Oracle SQL Dev...
what is a service contract, operation contract and Data Contract? - part 1 In the below sample we ha...