26.11.2012 Views

Compiler Usage Guidelines for 64-Bit Operating Systems on AMD64 ...

Compiler Usage Guidelines for 64-Bit Operating Systems on AMD64 ...

Compiler Usage Guidelines for 64-Bit Operating Systems on AMD64 ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<str<strong>on</strong>g>Compiler</str<strong>on</strong>g> <str<strong>on</strong>g>Usage</str<strong>on</strong>g> <str<strong>on</strong>g>Guidelines</str<strong>on</strong>g> <str<strong>on</strong>g>for</str<strong>on</strong>g> AMD<str<strong>on</strong>g>64</str<strong>on</strong>g> Plat<str<strong>on</strong>g>for</str<strong>on</strong>g>ms<br />

32035 Rev. 3.22 November 2007<br />

Use portable, scalable data types like INT_PTR, UINT_PTR, LONG_PTR, and ULONG_PTR <str<strong>on</strong>g>for</str<strong>on</strong>g><br />

type-casting pointers.<br />

Issues such as these can be detected by using the /Wp<str<strong>on</strong>g>64</str<strong>on</strong>g> switch.<br />

4.13 Sun <str<strong>on</strong>g>Compiler</str<strong>on</strong>g>s (32-bit) <str<strong>on</strong>g>for</str<strong>on</strong>g> Solaris<br />

This secti<strong>on</strong> addresses errors and unexpected results that may be encountered when using 32-bit Sun<br />

compilers <str<strong>on</strong>g>for</str<strong>on</strong>g> Solaris.<br />

4.13.1 Compilati<strong>on</strong> Errors<br />

Do you need ANSI-compliant code?<br />

If a developer needs ANSI-compliant code, Sun Studio provides several switches to detect and print<br />

errors and warnings about n<strong>on</strong>-c<strong>on</strong><str<strong>on</strong>g>for</str<strong>on</strong>g>ming c<strong>on</strong>structs. The -Xc switch specifies ISO C compliance<br />

without K&R extensi<strong>on</strong>s. A number of additi<strong>on</strong>al switches are available to check compliance with<br />

various combinati<strong>on</strong>s of standards and extensi<strong>on</strong>s.<br />

4.13.2 Compiled and Linked Code Generates Unexpected Results<br />

Does your program depend <strong>on</strong> precise floating-point behavior? Does your program depend <strong>on</strong> the<br />

exact implementati<strong>on</strong> of the IEEE 754 floating-point standard?<br />

The -fsimple[=n] switch (implied by the -fast switch) may cause the compiler to generate code that<br />

does not comply with the IEEE 754 floating-point standard. To guarantee compliance with the IEEE<br />

754 floating-point standard, this switch must be set to value 0.<br />

Do you need access to a frame pointer register?<br />

The compilers by default do not use the stack frame pointer register to improve per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance. If this<br />

register is needed <str<strong>on</strong>g>for</str<strong>on</strong>g> debugging or per<str<strong>on</strong>g>for</str<strong>on</strong>g>mance analysis tools, or <str<strong>on</strong>g>for</str<strong>on</strong>g> C++ excepti<strong>on</strong>s, it can be<br />

enabled with the -xregs=no%frameptr switch.<br />

54 Troubleshooting and Portability Issues Chapter 4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!