Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

__attribute__ ((packed))

Name: Anonymous 2011-10-18 17:40

Forget about it and and your C/C++ code now fwrites broken files! Cool?

Name: Anonymous 2011-10-18 17:48

__attribute__ ((aligned)) is superior.

Name: Anonymous 2011-10-18 17:50

>>2
It's useless.

Name: Anonymous 2011-10-18 18:06

Real men write serialization and unserialization functions for every struct.

Name: Anonymous 2011-10-18 18:11

>>4
serialization in machinecode

niggawhatareyoudoing.xpm

Name: Anonymous 2011-10-18 18:36

>>4
Why would you want to do that when you have compile-time introspection? :confused:

Name: Anonymous 2011-10-18 19:41

INTROSPECT MY ANUS

Name: Anonymous 2011-10-18 19:50

Write a struct to a file and just rely on however your particular compiler chooses to align things and you'll get what you deserve.  Define your file format and write things where you want them and you'll become one with the universe.

Name: Anonymous 2011-10-18 19:50

>Shit I didn't know about.
Well, just not in this thread.

Name: Anonymous 2011-10-18 20:02

Real men don't fwrite arrays of structures, they write structures of arrays.

If you're using fwrite, you're doing it wrong.

Name: Anonymous 2011-10-18 23:59

<---------------------------------------------------check mah dubz

Name: Anonymous 2011-10-19 2:41

#pragma pack(1)

Name: Anonymous 2011-10-19 2:48

PACK MY ANUS

Name: Anonymous 2011-10-19 6:03

The compiler will lay out a struct in a way that is optimal for in-memory access. You don't want to use __attribute__ ((packed)) on anything that's not explicitly and only used for reading and writing external media. Even then, you still have to deal with endian issues.

Don't change these.
Name: Email:
Entire Thread Thread List