Changes between Initial Version and Version 1 of rfc8_devguide


Ignore:
Timestamp:
Apr 28, 2007, 12:15:10 PM (17 years ago)
Author:
warmerdam
Comment:

Ported from doxygen.

Legend:

Unmodified
Added
Removed
Modified
  • rfc8_devguide

    v1 v1  
     1
     2= RFC 8: Developer Guidelines =
     3
     4Author: Frank Warmerdam[[BR]]
     5Contact: warmerdam@pobox.com[[BR]]
     6Status: draft
     7
     8== Purpose ==
     9
     10This document is intended to document developer practices for the GDAL/OGR
     11project.  It will be an evolving document. 
     12
     13== Portability ==
     14
     15GDAL strives to be widely portable to 32bit and 64bit computing environments.
     16It accomplishes this in a number of ways - avoid compiler specific directives,
     17avoiding new, but perhaps not widely available aspects of C++, and most
     18importantly by abstracting platform specific operations in CPL functions
     19in the gdal/port directory. 
     20
     21Generally speaking, where available CPL functions should be used in preference
     22to operating system functions for operations like memory allocation,
     23path parsing, filesystem io, multithreading functions, and ODBC access.
     24
     25== Variable Naming ==
     26
     27Much of the existing GDAL and OGR code uses an adapted Hungarian naming
     28convention.  Use of this convention is not manditory, but when maintaining
     29code using this convention it is desirable to continue adhering to it with
     30changes.  Most importantly, please avoiding using it improperly as that can
     31be very confusing.
     32
     33In Hungarian prefixing the prefix tells something about about the type, and
     34potentially semantics of a variable.  The following are some prefixes used
     35in GDAL/OGR.
     36
     37 * '''p''': pointer
     38 * '''a''': array
     39 * '''sz''': zero terminated string (eg."   char szName[100];")
     40 * '''psz''': pointer to a zero terminated string. (eg. "char *pszName;")
     41 * '''n''': integer number (size unspecified)
     42 * '''i''': integer number used as a zero based array or loop index.
     43 * '''f''': floating point value (single precision)
     44 * '''df''': floating point value (double precision)
     45 * '''o''': c++ object
     46 * '''os''': CPLString
     47 * '''h''': an opaque handle (such as GDALDatasetH).
     48
     49Prefix can be stacked.  The following are some examples of meaningful
     50variables.
     51
     52 * '''char **papszTokens''': Pointer to an array of strings.
     53 * '''int *panBands''': Pointer to an array of numbers.
     54 * '''double *padfScanline''': Pointer to an array of doubles.
     55 * '''double *pdfMeanRet''': Pointer to a single double.
     56 * '''GDALRasterBand *poBand''': Pointer to a single object.
     57
     58It may also be noted that the standard convention for variable names
     59is to capitalize each word in a variable name.
     60
     61== Headers, and Comment Blocks ==
     62
     63== Misc. Notes ==
     64
     65 * Use lower case filenames.
     66 * Use .cpp extension for C++ files (not .cc).
     67 * Avoid spaces or other special characters in file or directory names.
     68 * Use 4 character indentation levels.
     69 * Use spaces instead of hard tab characters in source code.
     70 * Try to keep lines to 79 characters or less.
     71