Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: SIZEOF returns more than datatype should be



Permlink Replies: 3 - Last Post: Jul 4, 2017 11:58 PM Last Post By: Remy Lebeau (Te... Threads: [ Previous | Next ]
hoang trung

Posts: 1
Registered: 7/22/17
SIZEOF returns more than datatype should be
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 22, 2017 12:38 AM
The obstinacy of denial always permitted me to disregard calendars and mirrors. I had been, within my thick mind, some indistinct age between 22 and 35.

That perpetual youth permitted me to remain firmly astride the culture. My sports passions were everyman's sports passions. The children who skateboarded, performed games and did not get baseball were outdoors the mainstream, not me. what size skateboard should i get

Then, after i was watching the All-Star Game at Detroit's Comerica Park on Tuesday, a juxtaposition of televised images revealed the sobering truth _ I had been a relic.

Outdoors that new stadium, garishly decked-out ballplayers made their pre-game entrances within the backs of shiny convertibles, riding lower a extended and wide red carpet like parading potentates.

"My suit," Boston's Johnny Damon told an insipid questioner, "was created by Ernest Abboud."

Prior to the next embarrassed player might be uncovered to inane questions, the director cut by getting an aerial shot of downtown Detroit. There, within the distant corner within the screen, sitting Tiger Stadium, empty and forlorn.

Because instant, that old ballpark symbolized the world I'd known similar to clearly because the Red Carpet Show at Comerica displayed some alien world. It had been there. This process did not matter greatly any longer.

Tiger Stadium, in the couple of sense, symbolized my sports heroes and remembrances. I suppose Irrrve never observed for the time being that point had relegated these for the borders of relevance.

Was Eddie Mathews really dead? Will it be that no-one under 40 remembers going to a game at Connie Mack Stadium? Does not anybody recall Tony Curry?

Individuals were people and places where mattered. Did not they?

Possibly that spectre of insignificance can be a payback. Maybe I'd have essential for carefully when my dad attempted to tell me about Indian Bob Manley or when my grandfather prattled on about Baker Bowl.

However that was different. Everything happened before I had been born. The incessant remembrances of boring old people did not interest me then. They just were not as interesting once i used to be i told my very own, personal, personal boy everybody fascinating tales in regards to the players, teams and ballparks I loved. how to build a skateboard

No under, that perhaps things i believed until Tuesday.

Now Mathews and Connie Mack live in exactly the same moldy warehouse where Indian Bob and Baker Bowl were stored formerly.

When you will uncover Tiger Stadium there, too.

Two will not fit. Speaking concerning the absurdity within the All-Star Game's Red Carpet Show, did anybody understand that the Red Sox World Series ring Damon used am enormous it might have encircled Curt Schilling's ego?

San Jose, Atlanta and hd188753. Scientists inside the California Institute of Technology now discovered a completely new planet located 875 trillion miles from earth.

Apparently, the Nhl happen to be thinking about creating a franchise there.

Print no World Series tickets. This Years Washington Nationals bear an incredible resemblance for the 1964 Phillies.

Keep in mind that both:

Were managed by very feisty men (Gene Mauch, Frank Robinson) who had previously been unpopular with players both inside and out of doors of doorways their dugouts.

Were essentially appear _ bunting, moving runners, and playing hit-and-visit offset insufficient offense.

Needed an unpredicted and extended lead despite competition from numerous teams with elevated talent.

Transformed injuries to new first basemen (Roy Sievers, Nick Manley) but got greater than expected using their no-name bullpens (Erection disorder Roebuck and Jack Baldschun, Luis Ayala and Chad Cordero).

Trivia quiz. This headline demonstrated up in this region in Thursday's Inquirer: "Egg Mind euthanized." Achieved it reference:

a. an "O'Reilly Factor segment within the aftermath inside the Harvard professor's endorsement of welfare?

b. Humpty Dumpty's failure to complete an entire time earnings will? how to get better at skateboarding

c. a Philadelphia Park-trained horse being put lower?

Edited by: hoang trung on Jul 4, 2017 11:52 PM

Edited by: hoang trung on Jul 4, 2017 11:55 PM

Asger Joergensen

Posts: 370
Registered: 11/18/08
Re: SIZEOF returns more than datatype should be
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 22, 2017 1:51 AM   in response to: hoang trung in response to: hoang trung
Hi hoang

I think you should try using:

#pragma pack(push,1)

Best regards
Asger
Rudy Velthuis (...


Posts: 7,731
Registered: 9/22/99
Re: SIZEOF returns more than datatype should be
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 22, 2017 9:54 AM   in response to: hoang trung in response to: hoang trung
hoang trung wrote:

Hello,

I have a problem that I can't seem to get past. I have a structure
that has exactly 38 bytes data. However, when I go to use the
sizeof() to allocate the memory, it always returns 40 bytes.

To byte align, you use #pragma pack(push, 1), AFAIK, not (push, 8).

--
Rudy Velthuis http://www.rvelthuis.de

"Devlin's First Law - Buyer beware: in the hands of a charlatan,
mathematics can be used to make a vacuous argument look
impressive.
Devlin's Second Law - So can PowerPoint." -- Keith Devlin
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: SIZEOF returns more than datatype should be
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 22, 2017 9:55 AM   in response to: hoang trung in response to: hoang trung
hoang trung wrote:

I have a problem that I can't seem to get past. I have a structure
that has exactly 38 bytes data. However, when I go to use the
sizeof() to allocate the memory, it always returns 40 bytes.

That means there is alignment padding between some of the data members.

I have attempted to use the #pragma pack(push,8) to byte align it

That is quad alignment, not byte alignment. The number in the last
parameter is expressed in bytes, not bits. So, for byte alignment, use
1 instead of 8.

Is the compiler padding the last two bytes?

Yes, because you set the struct's alignment to 8 bytes, so the compiler
has to pad the remaining size of the struct to the next even multiple
of 8, which is 40.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02