Garry Turcotte <garry@qnx.com> wrote:
GT > Bill Caroselli wrote:
Bill Caroselli <> qtps@earthlink.net> > wrote:
BC > I have a QNX4 program that I’m porting to QNX6 that exhibits a problem
BC > with ofstream. The program was quite large but I was able to trim it
BC > down to the following:
BC > ============================
BC > #include <fstream.h
BC > ofstream outfile; // this would get opened subsequently
BC > int main ( )
BC > { return 0; }
BC > ============================
BC > This compiles OK but if I try to run it it crashes with a SIGSEGV.
GT > I’ll need to see exactly how you compile and link.
GT > I tried cc/qcc/QCC -o tt tt.cc and I can’t get the segv.
OK. My makefiles, and hence my command lines, are a mile long, but I
finally narrowed it down to the offending parameter.
If I compile with ‘-fshort-enums’ and -Vgcc_ntox86_cpp, then it
compiles OK but I get the SIGSEGV when I try to run it.
I know that most of the streams library is implemented using templates
but perhaps some of it is not, so I can certainly understand why this
makes it fail.
I am using -fshort-enums because I have many enums where there are just
a few values defined and that enum is included inside of a struct, and
I want the size of that enum in the struct to be only 1 byte.
I.E.
enum my_enum
{
one = 1,
two = 2
};
struct my_struct
{
my_enum e;
} ms;
This is done to share communications records with other systems where
I can’t just increase the size of the enum.
Is there a way to achieve what I need to achieve?