Re: C++ compilers on Linux supporting 64bit architecture?

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

 



On Saturday 1 September 2007 2:27:41 pm Sam Varshavchik wrote:
> Bo Berglund writes:
> > 3) The program is written in C++, would there be big porting issues
> > moving it from Windows to Linux, code-wise?
>
> That depends upon what libraries your C++ code uses. If it uses
> Windows-specific libraries, any GUI libraries, they are obviously not
> available on Linux.
>
> If your C++ code uses only the standard C library and only the C++ STL, it
> should compile and run on Linux with minimum fuss, unless, without your
> knowledge or awareness, you are using any Microsoft-specific perversions of
> standard C library calls or C++ STL, in your code.

Even once you have worked through the slight oddities that mean C++ on windows 
isn't quite the same as C++ on linux, you can find cases where at run time 
you don't get the same results. If this is important to you it can be a right 
pain to trace problems. A couple examples found recently in a project I work 
on that supports both windows and linux, 

 float x = pow( 10, -6 ); 
  
on linux this gives you 1e-6. On windows you get 0 !! 

std::sort( .... ); The STL standard states that for elements that are "equal" 
(whatever that means for the predicate) the final order is not defined. 
Anything which is not defined in the standard you can read as possibly 
platform dependant. IN this case the fix is easily, as std::stable_sort(...) 
is for exactly this case, as in preserve the original order of 'equal' 
elements.

These are just two examples, I'm sure there are many other ways in which you 
could find linux and windows don't give identical results. If you care about 
this, you might have a lot of debugging on your ands.

On the plus side, testing your code on two quite different platforms is quite 
enlightening and useful in a testing sense. Both linux and windows can have 
oddities and things which diverge from the standard, and this is a great way 
to find them....

Chris


-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux