Puzzled by this behavior
Steven Schveighoffer
schveiguy at gmail.com
Wed Jun 1 00:29:30 UTC 2022
On 5/31/22 8:17 PM, Timon Gehr wrote:
> On 31.05.22 22:24, Steven Schveighoffer wrote:
>> On 5/31/22 4:13 PM, Max Samukha wrote:
>>> On Tuesday, 31 May 2022 at 19:59:21 UTC, Steven Schveighoffer wrote:
>>>
>>>> This is done on purpose.
>>>
>>> What's the purpose? It looks like just another atavism, reproducing
>>> itself without any purpose.
>>
>> To make code that is ported from C compile the same as it does in C.
>>
>
> There are local functions in C?
I mean the lookup mechanisms are the same.
But yeah, there are no local functions in C. I just figured that this is
so the compiler doesn't have to have weird special cases for lookups.
However, thinking about it more, we *do* allow function prototypes as
local functions. But I can't figure out a way to actually define them,
aside from using pragma(mangle).
I think there's an opportunity here where we can allow function
prototypes, allow definitions later, and not break existing code.
-Steve
More information about the Digitalmars-d
mailing list