RE: [Dev-C++] Copy Constructors and Overloaded Assignment Operators
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ho...> - 2002-07-23 11:47:07
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Matthew Hickson > Sent: Tuesday, July 23, 2002 12:39 AM > To: Dev-C++ Mailing List > Subject: Re: [Dev-C++] Copy Constructors and Overloaded > Assignment Operators > > Yeah, I'd forgotten about that. > > I don't worry about portability that much (my primary language being > proprietary). Time > to change my thinking. > > But, is it safe to say that everything should be okay if this > methodolgy > is used for > in-memory state maintenance? You can store data in files in a portable way using text mode (which occupies much space). If you store in binary mode the file is system dependent, that is that the same program compiled in a different compiler (or even a different version of the same compiler) is not guaranteed to read the data properly. I do not know if it is safe when you use the Win32 API. Are they the same funtions precompiled for all compilers in a dll, or every compiler provides its own version of Win32 API? Anyone who knows please inform us. I am studying .NET, and in .NET the same dll is provided (mscorlib.dll) for every compiler. I guess the same is true for Win32 API. But even if Win32 API facilities are the same for every Windows compiler, the binary file is not portable to other OSes. But the text is (that's why HTML, etc are text). But why use files in the first place. I think it is more convenient (and time efficient) to use "roll-back" variables where you will store the previous values. > Use conditional compilation? (#ifdef, etc.) The ANSI C++ file facilities are enough. > How worried are people about bit problems (i.e. endian-ness cross > platform, like Intel to PowerPC). > > I'd never really stopped to think about it until it came up > ... I forget > where now, but it was an interesting point. > > > My favourite part of lists like this is to throw something > out and see > how the community at large > responds. It usually points out weaknesses, and alternatives. It's > always good! 8-) In summary if you want to use (system-dependent) binary files use the ANSII C++ provided facilities. The code will be portable (compile everywhere but by definition binary files are not portable). Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net * Alternative URL: http://run.to/noicys |