Advertisement

VC++ 6 IntelliSense with local structures

Started by March 24, 2000 04:32 AM
13 comments, last by Spiff 24 years, 7 months ago
Hmm....my book never mentioned the typedef word, what''s the difference? It seems to work the same to me without it.

============================
Daniel Netz, Sentinel Design
"I'm not stupid, I'm from Sweden" - Unknown
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown
Actually void, that still requires you to declare it outside of local scope in order for intellisense to work. (at least on my installation of VC 6). Probably it just doesn''t work on local structures.

typedef ;

Creates a new type with the label of the identifier as it''s name with identical properties as the type in type declaration.

ex:
typedef int cow;
creates a new type, called cow, that has the same properties as an int.

ex:
typedef struct {int x;int y;} Dog; 

creates a new type called Dog, that has the same properties as struct { int x; int y; }.
Instead of declaring
struct Dog Beagle; 

you would use:
Dog Beagle; 


This simplifies coding in some instances. I tend to use typedefs on all my structures.
Advertisement
OK, I understand the typedef word now, but I''m using C++, the struct word in a structure declaration is only needed in C right?

I also think that we''ve come to the end of this, IntelliSense does not work on local structures...but I''ll live. Thanks bunches.

============================
Daniel Netz, Sentinel Design
"I'm not stupid, I'm from Sweden" - Unknown
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown
oh.. I missed the local declaration part.

I thought it was global declaration.

Why would u want to define a local struct anyway??

..
Well, I''m afraid that''s just what Microsoft said too. I''ve know that local structures aren''t really useful, but that doesn''t mean that people don''t use it.

The reason I stumpled across this bug was that I''m learning C++ from a book, and I just wrote a simple structure in my main function, it wasn''t because I needed one.

============================
Daniel Netz, Sentinel Design
"I'm not stupid, I'm from Sweden" - Unknown
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown

This topic is closed to new replies.

Advertisement