Author Topic: C++ compiler options  (Read 1607 times)

Offline jzakiya

  • Hero Member
  • *****
  • Posts: 567
C++ compiler options
« on: September 18, 2011, 11:46:00 AM »
My old laptop had aa Intel P4 cpu (32 bit) and I got a new one
with and Intel I5 (4 cores) cpu (64 bit).

I had compiled a C++ math app on my P4 laptop with

g++ <source_code> -o <executable_name>

It run fine on the I5....but

Since the I5 is 64 bits, and I have 6GB of mem
(using the 2.6.38.8-pclos3.pae.bfs kernel)
I want the arrays in the app to extend beyond the
32 bit limit imposed by the P4 compilation.

So, can I recompile the source with g++ to take
full advantage of the memory space and 64-bit registers
even though the PCLOS 2011.6 is a 32-bit compile?

I want the arrays in the app to be larger than 4GB,
and be able to do math on 64-bit numbers, and store them
as such.

Offline The Chief

  • Hero Member
  • *****
  • Posts: 2262
Re: C++ compiler options
« Reply #1 on: September 18, 2011, 06:04:24 PM »
I want the arrays in the app to extend beyond the
32 bit limit imposed by the P4 compilation.

Don't think so. 

The array index limit is set by the C language standard, I believe, so even a 64 bit compiler would still have the same limitations. 

The limit certainly didn't change when we went from 16 bits to 32 bits.  Or when we went from 8 to 16 bits.

Retired Senior Chief, Retired Software Engineer, Active GrandPa