Hi,
What is the purpose of using empty structures in C? I know this is only a gcc extension.
Thanks,
This is a discussion on Empty structures within the C Programming forums, part of the General Programming Boards category; Hi, What is the purpose of using empty structures in C? I know this is only a gcc extension. Thanks,...
Hi,
What is the purpose of using empty structures in C? I know this is only a gcc extension.
Thanks,
Read the gcc extension to discover why they think it's a good idea (perhaps)?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.
Not much info regarding this extension. http://developer.apple.com/documenta...pty-Structures
I would like to know why someone would use an empty structure, you cannot assign anything...
It may on occasion allow
If both conditions were false, then the structure would be empty.Code:struct foo { #ifdef SOMETHING int a; #endif #ifdef SOMETHING_ELSE int b; #endif };
Without the extension, you might struggle to declare a minimally 'empty' struct containing only one char to make the compiler shut up.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.