[cfe-dev] Default argument type for function without prototype?
mats petersson via cfe-dev
cfe-dev at lists.llvm.org
Mon Jan 22 02:47:30 PST 2018
On 22 January 2018 at 07:41, Kirill Balunov via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> Thank you Csaba for the answer and the time spent!
> One more time I apologize for an off topic question.
>
> 2018-01-22 2:07 GMT+03:00 Csaba Raduly <rcsaba at gmail.com>:
>
>>
>> I don't understand this. A google search for "mailing list" returns
>> almost eight million results. You could have sent your question to any
>> of them.
>>
>
> I googled "clang mailing list" :-) and there are two options: 'cfe-dev'
> and 'cfe-commits'.
> And 'cfe-dev' - This list is for everything else Clang related (questions
> and answers, design discussions, etc).
>
I think the point is that this question is not for the Clang mailing list,
as it isn't a decision made by the Clang developers. What happens in your
example piece of code is dictated by a combination of calling convention
(which registers contain what when calling functions) combined with the
behaviour described in the C standard (why untyped arguments are `int`).
You may want to use a more modern C standard, the code you posted won't
compile as C++, nor will it compile with `-ansi` or `-std=c99`.
The code exhibits undefined behaviour, and you'll almost certainly get a
completely different result on x86-32 machine, yet a different result on an
ARM processor, and in some cases it may well crash or cause some other
"interesting" behaviour. And if you change the code a little bit, for
example add a variable in your `impl` function that uses floating point
calculations, it will do something completely different. Or maybe not...
It's undefined behaviour, so "anything can happen".
--
Mats
>
> With kind regards,
> -gdg
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180122/088d8948/attachment.html>
More information about the cfe-dev
mailing list