Menu

📰
72

an ambiguity in c89 which will never be fixed

sebsite.pw·sebsite.pw·about 1 month ago
#DvNHtjfl
#article#englishlanguage#scope
Reading 0:00
15s threshold

i found some ambiguous wording in the c89(/c90) standard, where gcc and clang disagree on the interpretation. it concerns the behavior of implicit function declarations, which were removed in c99, so this was never disambiguated. for those unaware: c89 has a cool "feature" where, if you try to call a function which doesn't exist, rather than erroring out, the function is implicitly declared as a function with unspecified parameters returning int. more specifically: if the function in a call expression is a non-parenthesized identifier which isn't in scope, it's inserted into scope as an extern int () . (a funny thing about this is that it means that seemingly superfluous parentheses around expressions affect semantics: f() inserts f into scope, but (f)() doesn't) anyways, i'm gonna show you a fun edge case with this feature. but to build up to it, let's start simple.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More