Some Obscure C Features
multun.net
Some Obscure C Features
1–10 of 147 posts
Re: Some Obscure C Features
#2These examples actually were more obscure than the usual list.
Re: Some Obscure C Features
#3These examples actually were more obscure than the usual list.
The multiple compatible function signature declaration got me. I pray that I'll never have to understand and work with code that looks like that.
Re: Some Obscure C Features
#4These examples actually were more obscure than the usual list.
[deleted]
Re: Some Obscure C Features
#5[deleted]
Re: Some Obscure C Features
#6These examples actually were more obscure than the usual list.
Yeah, I did know 3 of them[1] but the rest were completely new to me! Not that I’m an expert or anything, but I tend to enjoy reading about obscure C features. That sizeof can have side effects is... a bit crazy although the multiple compatible function declarations are horrifying.
[1] Array designators, Preprocessor is a functional language and a[b] is a syntactic sugar.
Re: Some Obscure C Features
#7Although calling the preprocessor "functional" is being too pleasant. The C preprocessor was always a text substitution system, so macro as parameter is not that "obscure". Of course, I may have missed something subtle in the example.
It's also not clear how to use that preprocessor example.
Re: Some Obscure C Features
#8sizeof actually doesn't evaluate its expression for side effects most of the time; only if the operand is a variable-length array is it evaluated.
Re: Some Obscure C Features
#9Here is an obscure c feature:
int main()
{
int a = 8;
{
int a = 4;
/* a is only scoped to this block */
}
printf("%d", a); /* prints 8 */
}
It is also why C++ is not a strict superset of CRe: Some Obscure C Features
#10These examples actually were more obscure than the usual list.
Amusingly enough, that’s because most of them are C99 features.