User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 16 Jun 2003, 11:26   #1
SbOlly
Spelling is for pussies
 
SbOlly's Avatar
 
Join Date: Mar 2003
Location: Actually, where the feck am I........?
Posts: 446
SbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant future
Static Struct member in C

What would be the purpose or result of making a struct member static? I can see the purpose of making a C++ member static, or a local variable static, but would this actually make any difference :

typedef struct SOMETHING
{
static unsigned int IOPAddress[2];
unsigned int IOPSize[2];
}
__________________
If God made me in his image, he's one fat ugly biatch.

I always get the soggy biscuit

Veni Vidi Codi
SbOlly is offline   Reply With Quote
Unread 16 Jun 2003, 11:45   #2
queball
Ball
 
queball's Avatar
 
Join Date: Oct 2001
Posts: 4,410
queball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so little
Re: Static Struct member in C

Quote:
Originally posted by SbOlly
What would be the purpose or result of making a struct member static? I can see the purpose of making a C++ member static, or a local variable static, but would this actually make any difference :

typedef struct SOMETHING
{
static unsigned int IOPAddress[2];
unsigned int IOPSize[2];
}
That IS a C++ member, since it ain't valid C (it doesn't compile with GCC at least).
It's a C++ class by another name.
queball is offline   Reply With Quote
Unread 16 Jun 2003, 11:57   #3
SbOlly
Spelling is for pussies
 
SbOlly's Avatar
 
Join Date: Mar 2003
Location: Actually, where the feck am I........?
Posts: 446
SbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant futureSbOlly has a brilliant future
Heh, it seems that it isn't valid C, but some compilers accept it (albeit in random ways).

So far in my tests, GCC complains when linking, and others either ignore the static, or in one extreme case promote any variable declaration of that struct to static.

So much for standards....
__________________
If God made me in his image, he's one fat ugly biatch.

I always get the soggy biscuit

Veni Vidi Codi
SbOlly is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 00:45.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018