Various BSD Networking Questions

Luminary
Posts: 5,143
Joined: 2002.04
Post: #16
"all computers" is too strong.

That struct will be aligned and packed the same on Mac OS X/PowerPC, Mac OS X/Intel, Windows/Intel and Linux/Intel, however.
Quote this message in a reply
Moderator
Posts: 370
Joined: 2006.08
Post: #17
that's good enough for me, then Smile
Thanks again everyone ^_^
-wyrmmage

Worlds at War (Current Project) - http://www.awkward-games.com/forum/
Quote this message in a reply
Member
Posts: 567
Joined: 2004.07
Post: #18
OSC: what x86 desktop computers have a non-regular (non-32) bit integer implementation?

It's not magic, it's Ruby.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #19
I don't understand the question, and I don't believe it would be a sane question even if I did understand it Rasp
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #20
I think he's asking what platforms wouldn't have 32 bit ints.
Quote this message in a reply
Moderator
Posts: 3,570
Joined: 2003.06
Post: #21
akb825 Wrote:I think he's asking what platforms wouldn't have 32 bit ints.
Sinclair 1000, TRS-80, Commodore 64, etc...
Quote this message in a reply
Moderator
Posts: 370
Joined: 2006.08
Post: #22
not to revive a dead topic, but...can I put booleans in my structs and still have no packing or alignment issues?
-wyrmmage

Worlds at War (Current Project) - http://www.awkward-games.com/forum/
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #23
packing/alignment issues are not related to the fields of a struct, you should always be serializing it "manually"

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Moderator
Posts: 370
Joined: 2006.08
Post: #24
wait, what? OSC said that if I used types of a fixed length like float or int32_t, I wouldn't have any packing issues...I'm just wondering if the same goes for boolean. How do you manually make sure that they're serialized?
-wyrmmage

Worlds at War (Current Project) - http://www.awkward-games.com/forum/
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #25
Use uint8_t for booleans.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #26
Code:
void write_struct(char * buffer, struct foo * foo) {
  buffer = write_int8(buffer, foo->x);
  buffer = write_int8(buffer, foo->y);
  buffer = write_float8(buffer, foo->angle);
  buffer = write_string(buffer, foo->player_name);
  // etc
}

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Newbie networking - just dl'ing data from an URL... sealfin 4 3,418 Apr 19, 2007 07:01 AM
Last Post: sealfin
  Good networking library Ummon 5 4,387 Jan 22, 2007 11:59 PM
Last Post: akb825
  Simple networking? CarbonX 13 7,030 Apr 7, 2005 12:36 AM
Last Post: Andrew
  Saving a Place for Networking Roosterhouse 3 3,901 Aug 6, 2004 02:05 PM
Last Post: FCCovett
  Networking for Multiplayer Games Where to start? NYGhost 2 3,381 Jan 28, 2004 09:15 AM
Last Post: Skorche