Alignment in C++

P

puzzlecracker

I wasn't as to how pertinent this section is for the following
question, but I did receive this question in some relation to C++. In
addition, I couldn't find a better fitting section for the question
(please direct me to the proper section although I would HIGHLY
APPRECIATE IF SOMEONE CAN ANSWER OR GIVE POINTERS TO where I CAN GET
THE ANSWER AND UNDERLINING EXPLANATION, for this is prime, favorite and
trustworthy group).

Here it goes:

What are the alignment rules for 16, 32, 64 bit machine - would
certainly appreciate a down-to-earth, comprehensive reference? For
example, what is the layout for these examples?
a)

Code:
struct
{
short int a;
int b;
};



b)
Code:
struct{
short int a;
int b;
int somefunc();
virtual int func1();
};

c) Very Tricky (Hint: it is tricky with virtual function (or should I
say pointers to vtable...you should know something about vtables in
last but clever case))

Code:
struct{
short int a;
int b;
virtual int func_1();
virtual int func_2();
:
:
virtual int func_n();
};



And lastly, is there a group for algorithms particularly a riddle type,
(problems - such as to find a largest subarray in array of positive and
negative integers, or contests type)... also where a somewhat decent
analysis of algorithms takes place... thanks a million!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top