473,414 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

querry related to structure padding

hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .
because variable 'A' going to take 4 byte then four charachter of
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .
and last four byte by integer C .

what i want is there any way i can start storing integer C just after
the storing completion of array B's last element i.e. B[4] , so that i
can suppress padding . Any program which make memory manager store in
the above manner is most welcome.
thanks priorly because i am sure i am gonna get innumerable answer to
it .

Mar 19 '06 #1
20 2282
Lalatendu Das wrote:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .
because variable 'A' going to take 4 byte then four charachter of
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .
and last four byte by integer C .

what i want is there any way i can start storing integer C just after
the storing completion of array B's last element i.e. B[4] , so that i
can suppress padding . Any program which make memory manager store in
the above manner is most welcome.
thanks priorly because i am sure i am gonna get innumerable answer to
it .


No, not portably. See: http://www.c-faq.com/struct/padding.html

Robert Gamble

Mar 19 '06 #2
On 18 Mar 2006 19:34:22 -0800, "Lalatendu Das" <la******@gmail.com>
wrote in comp.lang.c:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .
No, you are completely wrong. It is going to occupy sizeof(struct
test) bytes in memory, no more and no less.

On two different compilers that I use that will be exactly 7 bytes. On
several other compilers that I use that will be 9 bytes, while on
others it will be 10.
because variable 'A' going to take 4 byte then four charachter of
Variable 'A' is going to occupy sizeof(int) bytes. On various
compilers that I use, that varies between 1 and 4 bytes. There may or
may not be padding bytes after 'A'.
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .
and last four byte by integer C .
No, the array 'B' will not take 4 bytes and another 4 bytes, that is 8
bytes in total. Unlike everything else in your post, this is one
thing that is absolute. The array 'B' will occupy exactly 5 bytes, on
your compiler and on every C compiler that ever existed.

There might be padding bytes after 'B' before the start of the next
member. Perhaps that is what you are talking about. Those padding
bytes do not change the size of 'B', an array of 5 char will always
have a size of exactly 5 bytes.
what i want is there any way i can start storing integer C just after
the storing completion of array B's last element i.e. B[4] , so that i
can suppress padding . Any program which make memory manager store in
the above manner is most welcome.
What "memory manager"? There is no "memory manager" in C. The
compiler is allowed to insert padding after any member of a structure
to maintain alignment. On some hardware architectures, incorrect
alignment will cause a hardware trap that will shut down a program.
thanks priorly because i am sure i am gonna get innumerable answer to
it .


C does not define any mechanism for a programmer to override the
compiler's alignment decisions. Your particular compiler might
provide some non-standard mechanism to do this. You need to ask in a
compiler specific support group to find out if this is so, or study
your compiler's documentation. Even if such a non-standard mechanism
is available, it can significantly slow down the program on some
architectures.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Mar 19 '06 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lalatendu Das wrote:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .
Not on some platforms. It is conceivable that this structure will take up no
more than 6 bytes on some platforms, with or without tightly packed members.
because variable 'A' going to take 4 byte
Says who?
then four charachter of
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .
Again, says who?
and last four byte by integer C .
Again, says who?

Byte size (in bits), int size (in bytes), and alignment requirements are
compiler and platform specific, and my compiler and your compiler may differ
in any and all of the specifics.
what i want is there any way i can start storing integer C just after
the storing completion of array B's last element i.e. B[4] , so that i
can suppress padding . Any program which make memory manager store in
the above manner is most welcome.
That would take knowledge of how your compiler works, and what sort of options
it gives you.

You /might/ gain some economy of storage by re-arranging the members within
the structure so as to take advantage of your compiler's built-in alignment
requirements. For instance,

struct test {
int A;
int C;
char B[5];
};

might actually take less space, even without compiler options, than the
organization you suggested.
thanks priorly because i am sure i am gonna get innumerable answer to
it .

- --
Lew Pitcher

Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEHNiWagVFX4UWr64RAmzbAKDfsX5onft4vltCCqjHxl QuJCAX+wCg9lMY
a71cSjn13xF0Klbb2khYa+A=
=BJZs
-----END PGP SIGNATURE-----
Mar 19 '06 #4
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lew Pitcher wrote:
Lalatendu Das wrote:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .


Not on some platforms. It is conceivable that this structure will take up no
more than 6 bytes on some platforms, with or without tightly packed members.


Oops. Make that "no more than 7 bytes on some platforms"

- --
Lew Pitcher

Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEHNjfagVFX4UWr64RAgcLAKDwTDodfvOFbfsUI1pbOv L4hvriJgCgiluS
iylhlsuEYd0OxDex1os3KjI=
=gQEL
-----END PGP SIGNATURE-----
Mar 19 '06 #5
Lalatendu Das wrote:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .
because variable 'A' going to take 4 byte then four charachter of
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .
and last four byte by integer C .

what i want is there any way i can start storing integer C just after
the storing completion of array B's last element i.e. B[4] , so that i
can suppress padding . Any program which make memory manager store in
the above manner is most welcome.


Ok, declare your struct like this:

struct test {
int A;
char B[5];
unsigned char C[sizeof (int)];
};

To read an int out of the non-aligned area, use this function:

int get_nonaligned_int(const unsigned char *b)
{
int i, temp;
unsigned char *a = (unsigned char *)&temp;

for(i = 0; i < sizeof temp; i++)
a[i] = b[i];

return temp;
}

To store an int into the non-aligned area, use this function:

void set_nonaligned_int(unsigned char *b, int value)
{
int i;
unsigned char *a = (unsigned char *)&value;

for(i = 0; i < sizeof value; i++)
b[i] = a[i];
}

For example:

int main(void)
{
struct test foo;

foo.A = 13;
strcpy(foo.B, "abcd");
set_nonaligned_int(foo.C, 42);

return 0;
}

--
Simon.
Mar 19 '06 #6
"Lalatendu Das" <la******@gmail.com> writes:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .
because variable 'A' going to take 4 byte then four charachter of
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .
and last four byte by integer C .
Not necessarily. The size and alignment of type int are
implementation-specific.
what i want is there any way i can start storing integer C just after
the storing completion of array B's last element i.e. B[4] , so that i
can suppress padding . Any program which make memory manager store in
the above manner is most welcome.
thanks priorly because i am sure i am gonna get innumerable answer to
it .


<http://www.c-faq.com/>, question 2.12.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Mar 19 '06 #7
Lew Pitcher wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lalatendu Das wrote:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .


Not on some platforms. It is conceivable that this structure will take up no
more than 6 bytes on some platforms, with or without tightly packed members.
because variable 'A' going to take 4 byte


Says who?
then four charachter of
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .


Again, says who?
and last four byte by integer C .


Again, says who?

Byte size (in bits), int size (in bytes), and alignment requirements are
compiler and platform specific, and my compiler and your compiler may differ
in any and all of the specifics.
what i want is there any way i can start storing integer C just after
the storing completion of array B's last element i.e. B[4] , so that i
can suppress padding . Any program which make memory manager store in
the above manner is most welcome.


That would take knowledge of how your compiler works, and what sort of options
it gives you.

You /might/ gain some economy of storage by re-arranging the members within
the structure so as to take advantage of your compiler's built-in alignment
requirements. For instance,

struct test {
int A;
int C;
char B[5];
};

might actually take less space, even without compiler options, than the
organization you suggested.


Assuming ints are 4 bytes and require 4-byte alignment (as indicated by
the OP) I do not see how this could possibly take less space.

Robert Gamble

Mar 19 '06 #8
Simon Biber wrote:
Lalatendu Das wrote:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .
because variable 'A' going to take 4 byte then four charachter of
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .
and last four byte by integer C .

what i want is there any way i can start storing integer C just after
the storing completion of array B's last element i.e. B[4] , so that i
can suppress padding . Any program which make memory manager store in
the above manner is most welcome.


Ok, declare your struct like this:

struct test {
int A;
char B[5];
unsigned char C[sizeof (int)];
};


If the original structure took 16 bytes on the OP's implementation I
find it very difficult to believe that your suggestion would change the
storage required since it would still need 3 bytes of padding on the
end to maintain the alignment requirements of A (which is required to
support an array of struct test).

Robert Gamble

Mar 19 '06 #9
Robert Gamble wrote:
Simon Biber wrote:
Lalatendu Das wrote:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .
because variable 'A' going to take 4 byte then four charachter of
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .
and last four byte by integer C .

what i want is there any way i can start storing integer C just after
the storing completion of array B's last element i.e. B[4] , so that i
can suppress padding . Any program which make memory manager store in
the above manner is most welcome.


Ok, declare your struct like this:

struct test {
int A;
char B[5];
unsigned char C[sizeof (int)];
};

If the original structure took 16 bytes on the OP's implementation I
find it very difficult to believe that your suggestion would change the
storage required since it would still need 3 bytes of padding on the
end to maintain the alignment requirements of A (which is required to
support an array of struct test).


That's true. If you want to eliminate the padding, use the same trick
for element A.

struct test {
unsigned char A[sizeof (int)];
char B[5];
unsigned char C[sizeof (int)];
};

--
Simon.
Mar 19 '06 #10
Jack Klein wrote:
On 18 Mar 2006 19:34:22 -0800, "Lalatendu Das" <la******@gmail.com>
wrote in comp.lang.c:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .


No, you are completely wrong. It is going to occupy sizeof(struct
test) bytes in memory, no more and no less.

On two different compilers that I use that will be exactly 7 bytes. On
several other compilers that I use that will be 9 bytes, while on
others it will be 10.
because variable 'A' going to take 4 byte then four charachter of


Variable 'A' is going to occupy sizeof(int) bytes. On various
compilers that I use, that varies between 1 and 4 bytes. There may or
may not be padding bytes after 'A'.
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .
and last four byte by integer C .


No, the array 'B' will not take 4 bytes and another 4 bytes, that is 8
bytes in total. Unlike everything else in your post, this is one
thing that is absolute. The array 'B' will occupy exactly 5 bytes, on
your compiler and on every C compiler that ever existed.

There might be padding bytes after 'B' before the start of the next
member. Perhaps that is what you are talking about. Those padding
bytes do not change the size of 'B', an array of 5 char will always
have a size of exactly 5 bytes.


Dumb question:

A "byte" need not be 8 bits in size, though it is under PCs right?

Mar 19 '06 #11
Simon Biber wrote:
Robert Gamble wrote:
Simon Biber wrote:
Lalatendu Das wrote:

hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .
because variable 'A' going to take 4 byte then four charachter of
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .
and last four byte by integer C .

what i want is there any way i can start storing integer C just after
the storing completion of array B's last element i.e. B[4] , so that i
can suppress padding . Any program which make memory manager store in
the above manner is most welcome.
Ok, declare your struct like this:

struct test {
int A;
char B[5];
unsigned char C[sizeof (int)];
};


If the original structure took 16 bytes on the OP's implementation I
find it very difficult to believe that your suggestion would change the
storage required since it would still need 3 bytes of padding on the
end to maintain the alignment requirements of A (which is required to
support an array of struct test).

That's true. If you want to eliminate the padding, use the same trick
for element A.

struct test {
unsigned char A[sizeof (int)];
char B[5];
unsigned char C[sizeof (int)];
};

So how would you (portably) access A or C as an int?

Remember some architectures (Sparc for instance) fault at misaligned
access, and others will incur a significant runtime penalty.

--
Ian Collins.
Mar 19 '06 #12
"santosh" <sa*********@gmail.com> writes:
[...]
Dumb question:

A "byte" need not be 8 bits in size, though it is under PCs right?


Right. A byte is CHAR_BIT bits; CHAR_BIT is required to be at least 8.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Mar 19 '06 #13
Ian Collins wrote:
Simon Biber wrote:
Robert Gamble wrote:
Simon Biber wrote:

Lalatendu Das wrote:

> hi let's say i have a structure
> struct test {
> int A;
> char B[5];
> int C;
> };
> this above structure defination always going to take 16 byte in
> memeory in whatever manner we align the member variables while
> declaring a variable to it .
> because variable 'A' going to take 4 byte then four charachter of
> array gonna take another 4 bytes but the remaining will take also 4
> bytes due to four byte alignment nature of compiler .
> and last four byte by integer C .
>
> what i want is there any way i can start storing integer C just after
> the storing completion of array B's last element i.e. B[4] , so that i
> can suppress padding . Any program which make memory manager store in
> the above manner is most welcome.
Ok, declare your struct like this:

struct test {
int A;
char B[5];
unsigned char C[sizeof (int)];
};

If the original structure took 16 bytes on the OP's implementation I
find it very difficult to believe that your suggestion would change the
storage required since it would still need 3 bytes of padding on the
end to maintain the alignment requirements of A (which is required to
support an array of struct test).

That's true. If you want to eliminate the padding, use the same trick
for element A.

struct test {
unsigned char A[sizeof (int)];
char B[5];
unsigned char C[sizeof (int)];
};

So how would you (portably) access A or C as an int?


Simon provided a pair of functions for accessing A and C in his
original post which I responded to.
Remember some architectures (Sparc for instance) fault at misaligned
access, and others will incur a significant runtime penalty.


Robert Gamble

Mar 19 '06 #14
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Gamble wrote:
Lew Pitcher wrote:

[snip]
struct test {
int A;
int C;
char B[5];
};

might actually take less space, even without compiler options, than the
organization you suggested.


Assuming ints are 4 bytes and require 4-byte alignment (as indicated by
the OP) I do not see how this could possibly take less space.


A starts on an int boundary, and takes up an int's worth of space. This means
that C now starts on an int boundary, and there is no padding between A and C.
Assuming that char alignment can be on a char boundary, then there is no
padding between C and B either. So, with this layout, we get a structure
without padding between it's members.

OTOH, with the original structure,
struct test {
int A;
char B[5];
int C;
};


there may be padding between the B and C members, in order to ensure that the
C member is aligned on an int boundary.

Thus, the alternative layout I suggested /can/ be smaller (because of less
padding) than the original layout.
- --
Lew Pitcher

Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 (http://counter.li.org/)
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEHX2BagVFX4UWr64RAiJeAKC5gga/8y0lbqXuRP7ZnZDxca0FwgCfbRVW
SXjEPPl3AWGwsq/ahL3IJOY=
=YTg7
-----END PGP SIGNATURE-----
Mar 19 '06 #15
Lew Pitcher wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Gamble wrote:
Lew Pitcher wrote:

[snip]
struct test {
int A;
int C;
char B[5];
};

might actually take less space, even without compiler options, than the
organization you suggested.


Assuming ints are 4 bytes and require 4-byte alignment (as indicated by
the OP) I do not see how this could possibly take less space.


A starts on an int boundary, and takes up an int's worth of space. This means
that C now starts on an int boundary, and there is no padding between A and C.
Assuming that char alignment can be on a char boundary, then there is no
padding between C and B either. So, with this layout, we get a structure
without padding between it's members.


There may not be padding *between* the members but there is going to be
padding after C which, in this case, will be the same amount of padding
that existed between B and C in the original structure.

Robert Gamble

Mar 19 '06 #16
Lew Pitcher wrote:
Lalatendu Das wrote:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .


Not on some platforms. It is conceivable that this structure will
take up no more than 6 bytes on some platforms, with or without
tightly packed members.


No, with a CHAR_BIT of 16 it could conceivably take as little as 7
bytes, but with any smaller CHAR_BIT it will require at least 9
bytes. I would then expect at least one byte of padding for most
systems, making the expected minimum size 10. The more usual
systems will require 16 bytes.

--
Some informative links:
news:news.announce.newusers
http://www.geocities.com/nnqweb/
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.caliburn.nl/topposting.html
http://www.netmeister.org/news/learn2quote.html
Mar 19 '06 #17
Robert Gamble wrote:
.... snip ...
There may not be padding *between* the members but there is going
to be padding after C which, in this case, will be the same amount
of padding that existed between B and C in the original structure.


The only reason for this reply is that the misspelling in the
subject has been driving me mad. Mad, as in insane, or totally
discombobulated, I tell you.

I rejected quarry and quail as possible corrections.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Mar 19 '06 #18
Simon Biber <ne**@ralmin.cc> writes:
Lalatendu Das wrote:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
};
this above structure defination always going to take 16 byte in
memeory in whatever manner we align the member variables while
declaring a variable to it .
because variable 'A' going to take 4 byte then four charachter of
array gonna take another 4 bytes but the remaining will take also 4
bytes due to four byte alignment nature of compiler .
and last four byte by integer C .
what i want is there any way i can start storing integer C just after
the storing completion of array B's last element i.e. B[4] , so that i
can suppress padding . Any program which make memory manager store in
the above manner is most welcome.


Ok, declare your struct like this:

struct test {
int A;
char B[5];
unsigned char C[sizeof (int)];
};

[...]

The compiler is still free to insert padding between B and C, or after
C, either because it can make the code potentially more efficient (for
example, memcpy() might be faster for aligned character arrays) or
because the compiler writer was in a funny mood that day.

If you want to fully control the layout of a structure, declare the
whole thing as an array of unsigned char, define the offsets and sizes
yourself, and write your own code to extract whatever data you need.
That's the only truly portable way to match an externally defined data
layout (assuming consistent byte sizes, and assuming you're dealing
correctly with byte ordering).

Or you can use some compiler-specific tricks to control the layout
(which will almost certainly result in slower code).

But the real question (to which I don't recall seeing an answer) is
*why* the OP wants to eliminate padding between the structure members.
The compiler inserts that padding for very good reasons; are you sure
that you know better than the compiler does how the structure should
be laid out? Quite possibly you do, in which case you'll need to do
something non-portable and/or ugly -- but if you just have a general
idea that you want to save space, consider letting the compiler do its
job.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Mar 19 '06 #19
On 2006-03-19, Lalatendu Das <la******@gmail.com> wrote:
hi let's say i have a structure
struct test {
int A;
char B[5];
int C;
}; [...] what i want is there any way i can start storing integer C just
after the storing completion of array B's last element i.e. B[4] , so
that i can suppress padding.


#pragma pack(1)
struct test
{
int A;
char B[5];
int C;
};
#pragma pack()

will do what you want; this works with at least gcc 4, some Microsoft
compilers and perhaps some others.

It is not standard or portable, and everything everyone else has said
about asking yourself why you really want this goes.

Also, watch out for address alignment problems if you do this kind of
thing. Compilers have good reasons for padding structs!
Mar 20 '06 #20
On Sun, 19 Mar 2006 13:08:08 -0500, CBFalconer <cb********@yahoo.com>
wrote:
The only reason for this reply is that the misspelling in the
subject has been driving me mad. Mad, as in insane, or totally
discombobulated, I tell you.

I rejected quarry and quail as possible corrections.


It is possible that a "querry" is a pre-electronic version of an
equerry. That would be someone who cares for the horses of royalty but
who cannot do so at a distance.
Mar 21 '06 #21

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Amarendra | last post by:
Folks, This structure padding issue is bothering me now, could not locate a satisfactory answer on clc, so here it goes... I have a structure, given below: typedef struct { int flag; char...
2
by: Sachin | last post by:
typdef struct { int i; char ch; }str; str str_var; char x, y; main() { //do nothing
28
by: kyle york | last post by:
Greetings, Why does the C standard require the members of a structure not be re-ordered (6.2.5.20)? Padding is allowed, and platform dependent, which means one cannot rely on the exact layout...
4
by: junky_fellow | last post by:
Can somebody please tell me about the structure alignment rules ? What I found was that on my system (cygwin running on PC, size of int=4 sizeof long=4, size of long long = 8) the cygwin compiler...
24
by: karthikbalaguru | last post by:
Hi, I find that the structure padding is not being taken into account while using 'new' operator. Is there a way to enable it ? struct Dataunit { char dataid; int keyid;
10
by: Rohit kumar Chandel | last post by:
Hi All, Please let me know how to find in a structure whether compiler has used padding or not. Regards Rohit
12
by: Kislay | last post by:
case 1 : struct s { char c1; // 8 double d; // 8 int i1; // 4 char c2; // 4 int i2; // 4 };
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.