Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 VAX doesn't list members of a struct as this code
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

alex24
New Member

8 Posts

Posted - Aug 28 2014 :  08:28:40 AM  Show Profile  Reply with Quote
I'm using vc6, vax 10.8.2043.0.
and gcc-4.9.1(mingw64) with option -fms-extensions to compile the below code.
It seems VAX has no idea about the nameless "struct aaa;" in struct bbb#12290;

static void foobar()
{
	struct aaa{
		int base_a;
		int base_b;
	};

	struct bbb{
		struct aaa;
		int a;
		int b;
	}x;

	x.base_a;
	x.base_b;

	x.a;
}



alex24
New Member

8 Posts

Posted - Aug 28 2014 :  08:32:44 AM  Show Profile  Reply with Quote
VS2008 VS2010 also enable to compile this code.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Aug 28 2014 :  7:13:40 PM  Show Profile  Reply with Quote
That is a type name, a forward declaration, hence it's missing from the listbox.

Intellisense doesn't like it and cannot compile it either:
Go to Top of Page

alex24
New Member

8 Posts

Posted - Aug 28 2014 :  7:57:50 PM  Show Profile  Reply with Quote
quote:
Originally posted by accord

That is a type name, a forward declaration, hence it's missing from the listbox.

Intellisense doesn't like it and cannot compile it either:





	struct aaa{
		int base_a;
		int base_b;
	};

	struct bbb{
		struct aaa;
		int a;
		int b;
	}x;

is same as below code.


	struct bbb{
		struct {
			int base_a;
			int base_b;
		};
		int a;
		int b;
	}x;

It's not a forward declaration.
You can not use "x.aaa;", but you can use "x.base_a;".

See here:
GCC https://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html
VS support it by default.
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Aug 31 2014 :  6:07:29 PM  Show Profile  Reply with Quote
>VS support it by default.
Which version of Visual Studio are you using? (and which update?)
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 01 2014 :  12:04:01 PM  Show Profile  Reply with Quote
*ah* I misunderstood your post it seems, you want to use x.base_a, not x.aaa.

I've just installed Visual Studio 2013 Update 3 to see if it makes any different. I have tried both version of your example source and I am getting an error from the compiler and intellisense, see the attached screenshots.



Am I still missing something?
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Sep 01 2014 :  2:48:14 PM  Show Profile  Reply with Quote
Your code does not compile for me either. Under Windows 7, I have tried:

VS2008 SP1
VS2010 SP1
VS2012 Update 4
VS2013 Update 3

you say your code compiles in VS2008 and VS2010, what are you doing to the IDE to convince it to compile this code?

zen is the art of being at one with the two'ness
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 03 2014 :  5:19:19 PM  Show Profile  Reply with Quote
*ah* I missed the post where alex mentioned the VS version. (I wanted to try the latest compiler version so I had installed update 3, since MS improves the compiler even in the updates.)

Edited by - accord on Sep 03 2014 5:21:09 PM
Go to Top of Page

foxmuldr
Tomato Guru

USA
384 Posts

Posted - Sep 04 2014 :  09:57:46 AM  Show Profile  Reply with Quote
quote:
Originally posted by accord

*ah* I missed the post where alex mentioned the VS version. (I wanted to try the latest compiler version so I had installed update 3, since MS improves the compiler even in the updates.)



The OP is compiling with GCC 4.9.1, not Microsoft's compiler. GCC extensions recognize the pass-through token without using the parent aaa by some reference, but the MS compiler requires it.

It will never be recognized by VS and Intellisense (at least not today).

Best regards,
Rick C. Hodgin

Edited by - foxmuldr on Sep 04 2014 10:18:46 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Sep 04 2014 :  11:43:17 AM  Show Profile  Reply with Quote
I noticed that as well, but it is the second post that puzzles me:

quote:
VS2008 VS2010 also enable to compile this code.


Since that is not what I am seeing.

zen is the art of being at one with the two'ness
Go to Top of Page

foxmuldr
Tomato Guru

USA
384 Posts

Posted - Sep 04 2014 :  4:47:38 PM  Show Profile  Reply with Quote
I think the OP meant "unable to compile."
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Sep 04 2014 :  6:47:46 PM  Show Profile  Reply with Quote
Perhaps, but that does not make much sense, since telling us the code does not compile hardly encourages the idea that VA should support it. The only way this makes sense to me so far is if he is using a different compiler with the IDE, gcc in this case. We need more information.

zen is the art of being at one with the two'ness
Go to Top of Page

foxmuldr
Tomato Guru

USA
384 Posts

Posted - Sep 04 2014 :  7:36:01 PM  Show Profile  Reply with Quote
I think that's it. He's using VAX in various versions of Visual Studio from VC6 forward, but rather than using the built-in compiler with VS he's using a custom build tool with GCC. The code compiles and runs, but Intellisense is not supporting what the compiler supports (and I think he thinks it should -- I could be wrong though).
Go to Top of Page

alex24
New Member

8 Posts

Posted - Sep 09 2014 :  05:29:01 AM  Show Profile  Reply with Quote
Sorry for long time away from this topic.

I'm using C, not CPP. This code works fine with .c suffix.
Go to Top of Page

foxmuldr
Tomato Guru

USA
384 Posts

Posted - Sep 09 2014 :  11:04:44 AM  Show Profile  Reply with Quote
After your last post, I tried to get this to compile in GCC and I could not. GCC doesn't recognize it even with the .c extension. It does compile in VS2008 though.

alex24, I am just a user here at Whole Tomato. I read the forums and sometimes post. But, I am curious ... what is your need to write code using this feature? I like the ability it represents. Rather a lot actually. :-)
Go to Top of Page

alex24
New Member

8 Posts

Posted - Sep 09 2014 :  8:12:56 PM  Show Profile  Reply with Quote
Am I living in a parallel universe?


Or maybe the vs update change the compiler.

foxmuldr, which version of gcc are you using. I'm using gcc-4.9.1 as below
gcc -fms-extensions xxx.c
-fms-extensions must be enabled.

Since I'm writing C, but not CPP, with this feature I can make my C code style like "CPP Inheritance".

Go to Top of Page

foxmuldr
Tomato Guru

USA
384 Posts

Posted - Sep 09 2014 :  10:00:44 PM  Show Profile  Reply with Quote
I am using 4.8.1. I forgot to use -fms-extensions. :-) I think it's me living in the parallel universe.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000