C + + portability and cross-platform development [1]: Compiler

Source: Internet
Author: User
Tags relative

In the Cross-platform development process, many problems are related to the compiler. So let's talk about compiler-related issues first.

★ Compiler Selection

First of all, GCC is a priority to consider support because almost all operating system platforms have GCC available. It's basically a generic compiler. If your code is compiled on a platform of GCC and then gets a B platform to compile with a similar version of GCC, there's no big problem. So GCC is sure to consider support.

Second, consider whether to support local compilers. The local compiler is the compiler of the operating system manufacturer itself. For example, the local compiler relative to Windows is Visual C + +. The local compiler relative to Solaris is Sun's CC. If you are sensitive to performance or want to use advanced features of some local compilers, you may have to consider supporting the local compiler while GCC is supported.

★ Compile Warning

Compilers are friends of programmers, many potential problems (including portability), the compiler can find and give warning, if you usually pay attention to these warning messages, can reduce a lot of trouble. So I strongly recommend that: 1 turn the compiler warning level up; 2 do not easily ignore compiler warning messages.

★ Cross Compiler

Cross-compiler definitions see "Wikipedia". In layman's parlance, it is to compile a binary program running on platform B on platform A. If you're developing an application that runs on Solaris, but you don't have a SPARC machine running Solaris, then the crossover compiler can be useful. In general, GCC is used to make a cross compiler, limited to space, here is not a deep talk. Interested students can see "here".

About the compiler topic, temporarily chat to this, back to talk about "grammar" problem.

Original address: http://program-think.blogspot.com/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.