X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae8b97cf4ba6dc8c6bca5e76744c6dccb1ebbb59..da590c59c76028158708a0e9dea4e8e16ecceec2:/docs/html/standard.htm?ds=inline diff --git a/docs/html/standard.htm b/docs/html/standard.htm index 15ee6ef106..1b8e6cf15d 100644 --- a/docs/html/standard.htm +++ b/docs/html/standard.htm @@ -55,6 +55,7 @@ C++ portability guide by David Williams.
  • General recommendations
    1. +
    2. No C++ comments in C code>
    3. No global variables with constructor
    4. Turn on all warnings and eradicate them
    5. Don't rely on sizeof(int) == 2...
    6. @@ -71,6 +72,7 @@ C++ portability guide by David Williams.
    7. Avoid carriage returns in cross-platform code
    8. Use only lower letter filenames
    9. Terminate the files with a new-line
    10. +
    11. Avoid globals differing by case only

  • Style choices
  • @@ -104,8 +106,7 @@ C++ portability guide by David Williams.
  • More about naming conventions
    1. Use wx or WX prefix for all public symbols
    2. -
    3. Use WXDLLEXPORT with all classes/functions in - wxMSW/common code
    4. +
    5. Use WXDLLEXPORT with all classes/functions in wxMSW/common code
    6. Use Set/Get prefixes for accessors
    7. wxNAMING_CONSTANTS
    @@ -361,6 +362,18 @@ which must be followed if you wish to write correct, i.e. working, progra also contains some C/C++ specific remarks in the end which are less important.
      +

    1. No C++ comments in C code>
    2. +Never use C++ comments in C code - not all C compilers/preprocessors +understand them. Although we're mainly concerned with C++ here, there are +several files in wxWindows sources tree which are compiled with C compiler. +Among them are include/wx/setup.h and include/wx/expr.h. + +Another thing related to C vs C++ preprocessor differences is that some old C +preprocessors require that all directives start in the first column (while +it's generally allowed to have any amount of whitespace before them in C++), +so you should start them in the beginning of the line in files which are +compiled with C compiler. +

    3. No global variables with constructors
    4. In C++, the constructors of global variables are called before the main() function (or WinMain() or any other program entry point) @@ -577,6 +590,13 @@ While DOS/Windows compilers don't seem to mind, their Unix counterparts don't like files without terminating new-line. Such files also give a warning message when loaded to vim (the Unix programmer's editor of choice :-)), so please think about terminating the last line. + +

    5. Avoid globals differing by case only
    6. +The linker on VMS is case-insensitive. Therefore all external variables and +functions which differ only in case are not recognized by the linker as +different, so all externals should differ in more than the case only: +i.e. GetId is the same as . +


    @@ -815,12 +835,6 @@ WXDLLEXPORT_DATA(extern wxApp*) wxTheApp; The reason for the strange syntax for data is that some compilers use different keyword ordering for exporting data. -

    There also several other places where you should take care of shared -library case: all IMPLEMENT_xxx macros which are usually used in the -corresponding .cpp files must be taken inside -"#if !USE_SHARED_LIBRARY" and in the #if USE_SHARED_LIBRARY -case you should put them inside common/cmndata.cpp file. -

  • Use Set/Get prefixes for accessors

    There is a convention in wxWindows to prefix the accessors (i.e. any simple, in general, inline function which does nothing else except changing or returning