Re: [gtkmm] #pragma pack(1) and Gtk string Segmentation Faults

>In a gtkmm application I  #included a header file (written by another programm
>er) which contains the line:
>#pragma pack(1)

fire this programmer unless he was writing device drivers. if so, stop
including his header files. i am deadly serious.

you **CANNOT** **EVER** expect to use this in combination with any C
or C++ library that was compiled without this pragma, and since that
almost certainly means (g)libc on your system, the end result is that
you should **NEVER** **EVER** use this pragma in general purpose code.

gcc has the __attribute__ keyword, which is the right way to control
struct member alignment in those structs that need it. use the pragma
will change the layout of many structures declared in system headers,
gtk+ headers, gtkmm headers and god knows what else.

if the pragma has to be used for some bizarre reason, the header file
in which it was used is not suitable for use in any program other than
the one with the bizarre reason.

did i make that clear enough? :))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]