[cfe-dev] can foo() be called with arguments?
clattner at apple.com
Sun Feb 17 11:31:22 PST 2008
On Feb 17, 2008, at 11:17 AM, Eli Friedman wrote:
> On Feb 17, 2008 10:30 AM, Török Edwin <edwin at clamav.net> wrote:
>> From my reading of the C99 standard (N1256.pdf) calling foo with
>> parameters when it is declared as foo() is allowed only if the
>> declaration doesn't involve a definition too.
>> If it involves a definition, then you can't call it with parameters,
>> and foo() is equivalent to foo(void). Is this correct?
> See http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_317.htm.
> Essentially, executing the call is technically undefined behavior, but
> it's a perfectly legal construct. I've filed
> http://llvm.org/bugs/show_bug.cgi?id=2042 on the issue.
> It looks like your module does actually execute such an undefined
> call, so the program technically has undefined behavior. That said,
> I've never heard of a C compiler producing code that actually did
> anything weird... generally, C calling conventions allow for an
> arbitrary number of arguments even if the callee doesn't expect them
> for compatibility reasons.
I just checked in a fix for this,
More information about the cfe-dev