You could have the answer there. I *was* using Borland's C++ Builder. I'm getting a bit frustrated with my lack of memory, but I have got what i was trying to do working.
Thanks for the help
Roy...
User Profile
Collapse
-
Roy Strachan replied to How to initialize a structure variable to the size of the structure at compile time?in COK, OK. Now I feel stupid. My old memory remembered it wrong. I think all that I was doing was getting the size of the structure not actually allocating to it. Gotta admit this getting old thing is not for wimps. I haven't done any programming except for minor little things for about 10 years and I am finding that I have forgotten most of what I ever knew, if I ever really knew it. Also I'm finding that gcc is a lot more fussy that the old...Leave a comment:
-
Roy Strachan replied to How to initialize a structure variable to the size of the structure at compile time?in CI think you are missing the point of the question. There is no problem getting the size of the structure at run time, what I am trying to do is get the size at compile time and store that value in the structure itself; ie mys.size == sizeof(mys). This would probably require that the preprocessor make 2 passes so that the struct size is known. There should be some symbol that equates to the location at the start of the structure (data pointer?)...Leave a comment:
-
Roy Strachan started a topic How to initialize a structure variable to the size of the structure at compile time?in CHow to initialize a structure variable to the size of the structure at compile time?
I have seen this before and know it works (at least on an old Borland compiler). Unfortunately, though my memory is good, it's short. Using gcc how do I (can I?) initialize TESTSTRUCT.ssiz e to sizeof(TESTSTRU CT) at compile time?
first data location counter = ??
Code:typedef struct { int ssize = x; // The size of this structure long lvar; short svar; } TES
No activity results to display
Show More
Leave a comment: