top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

GCC Issue with unnammed nested struct in c

+1 vote
struct xx
 int x;
 struct yy *p;
 int s;
 int s;

int main()
 struct xx xyz;
 return 0;

the above code compile well without any warning. Here my question is
1. How can I distinguish two 's' variable.
2. What is use case.

posted Jun 26, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

You must be using an old version of GCC, it is an error with GCC 4.6 and later.

answer Jun 26, 2013 by anonymous
Similar Questions
+1 vote

Here's a small piece of code:

 static struct {
 const char fmt[10];
 } const x = { "%dn" };
 static const char * const fmt = "%dn";
 printf(fmt, 1);
 printf(x.fmt, 1);

The second printf produces a warning:

 test.c:105:10: warning: format string is not a string literal
 printf(x.fmt, 1);

From my point of view both format strings are identical. Why can't gcc deduce the format string in the second case?

0 votes

I'm studying about C compiler for increasing software quality. So I want to get all of compile error message list of gcc about C language. I was trying to find it. But I can't find it anywhere. How can I find it?

Please help?

+1 vote
  1. GCC is available in several variations (SJLJ, DW2, SEH). When compiling plain C code (therefore either assuming or explicitly specifying -fno-exceptions), does it make any difference which GCC variation is used?

  2. Further I assume, that if my plain C code was to link to a C++ library which may throw exceptions, then it would matter which GCC variation I use. In that case, I should use the GCC variation that matches with the C++ code exception flavour, I should enable -fexceptions when compiling my plain C code, and the exceptions could
    then propagate over the C code?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.