Click here to Skip to main content
15,915,858 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: My first Win32 program... Pin
sudhir_Kumar3-Jun-08 3:56
sudhir_Kumar3-Jun-08 3:56 
AnswerRe: My first Win32 program... Pin
Hamid_RT3-Jun-08 4:01
Hamid_RT3-Jun-08 4:01 
AnswerRe: My first Win32 program... Pin
sudhir_Kumar3-Jun-08 4:11
sudhir_Kumar3-Jun-08 4:11 
AnswerRe: My first Win32 program... Pin
toxcct3-Jun-08 5:02
toxcct3-Jun-08 5:02 
QuestionDifference b/w Unions and Structures... Pin
xelios3-Jun-08 3:12
xelios3-Jun-08 3:12 
AnswerRe: Difference b/w Unions and Structures... Pin
CPallini3-Jun-08 3:20
mveCPallini3-Jun-08 3:20 
AnswerRe: Difference b/w Unions and Structures... Pin
Alan Balkany3-Jun-08 3:20
Alan Balkany3-Jun-08 3:20 
GeneralRe: Difference b/w Unions and Structures... Pin
DQNOK3-Jun-08 9:28
professionalDQNOK3-Jun-08 9:28 
Alan Balkany wrote:
each one starts in the byte after the previous one ends.



Too specific to be the right answer for this newbie. One poster said "conceptually" the sizes of the members sum, which is correct *CONCEPTUALLY*.

We should probably point out to the original poster that in a structure, the compiler is free to add padding after ANY member (including the last member) to insure the members align correctly. That is, a structure may contain unused bytes that are there only for alignment.

struct example{
   char c;  //one byte?
   long l;  //four bytes?
};
printf( "sizeof(example) = %d", sizeof(example) );

In most compilers, this will NOT print "sizeof(example) = 5" as might be expected, since the compiler must put padding after c to insure that l aligns properly. In most modern compilers this will likely print "sizeof(example) = 8".

David
---------
Empirical studies indicate that 20% of the people drink 80% of the beer. With C++ developers, the rule is that 80% of the developers understand at most 20% of the language. It is not the same 20% for different people, so don't count on them to understand each other's code.
http://yosefk.com/c++fqa/picture.html#fqa-6.6

---------

AnswerRe: Difference b/w Unions and Structures... Pin
toxcct3-Jun-08 3:22
toxcct3-Jun-08 3:22 
AnswerRe: Difference b/w Unions and Structures... Pin
Hamid_RT3-Jun-08 3:32
Hamid_RT3-Jun-08 3:32 
General[Message Deleted] Pin
toxcct3-Jun-08 3:33
toxcct3-Jun-08 3:33 
GeneralRe: Difference b/w Unions and Structures... Pin
Hamid_RT3-Jun-08 4:00
Hamid_RT3-Jun-08 4:00 
AnswerRe: Difference b/w Unions and Structures... Pin
sudhir_Kumar3-Jun-08 3:59
sudhir_Kumar3-Jun-08 3:59 
Questionwhere can i get some unix filesystem emulator? Pin
sunerbun3-Jun-08 2:25
sunerbun3-Jun-08 2:25 
QuestionRe: where can i get some unix filesystem emulator? Pin
CPallini3-Jun-08 2:49
mveCPallini3-Jun-08 2:49 
AnswerRe: where can i get some unix filesystem emulator? Pin
toxcct3-Jun-08 2:55
toxcct3-Jun-08 2:55 
GeneralRe: where can i get some unix filesystem emulator? Pin
Hamid_RT3-Jun-08 3:10
Hamid_RT3-Jun-08 3:10 
GeneralRe: where can i get some unix filesystem emulator? Pin
toxcct3-Jun-08 3:12
toxcct3-Jun-08 3:12 
AnswerRe: where can i get some unix filesystem emulator? Pin
Rajkumar R3-Jun-08 3:11
Rajkumar R3-Jun-08 3:11 
QuestionIf one application is running second doesn't show up Pin
VCProgrammer3-Jun-08 1:57
VCProgrammer3-Jun-08 1:57 
AnswerRe: If one application is running second doesn't show up Pin
toxcct3-Jun-08 2:00
toxcct3-Jun-08 2:00 
GeneralRe: If one application is running second doesn't show up Pin
VCProgrammer3-Jun-08 2:21
VCProgrammer3-Jun-08 2:21 
GeneralRe: If one application is running second doesn't show up Pin
toxcct3-Jun-08 2:22
toxcct3-Jun-08 2:22 
AnswerRe: If one application is running second doesn't show up Pin
Hamid_RT3-Jun-08 2:00
Hamid_RT3-Jun-08 2:00 
AnswerRe: If one application is running second doesn't show up Pin
Cedric Moonen3-Jun-08 2:01
Cedric Moonen3-Jun-08 2:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.