This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
extern "C" - bug or feature
- To: <gcc-bugs at gcc dot gnu dot org>
- Subject: extern "C" - bug or feature
- From: "Anton Shevchenko" <sanc0der at mail dot ru>
- Date: Fri, 15 Sep 2000 12:25:38 +0400
First of all, I have wondered that this simple question I want to ask you is
not on the page with bugs already.
The situation is very simple (gcc 2.95.2, cygwin-686).
I have approximately the following structure of program :
main.cpp :
extern "C" {
#include "struct.h"
}
#include <stdio.h>
void main() { printf ("sizeof(struct s2) = %d\n", sizeof(struct s2); }
struct.h :
struct s1 { long a; };
struct s2 { struct s1; long b; };
That's all!
When I've compiled the main.cpp I get the result : 4. But when rename it (to
main.c) , then delete 2 lines (extern "C"), then compile, I get result : 8.
I REALLY UNDERSTAND that in C++ I get the right result, if I've NOT
SPECIFIED extern "C". But I specified. Is the result I got right????
Hoping for an answer.
Anton