My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
CodingStyle  
OpenJPEG Coding Style
Updated Mar 13, 2012 by mathieu.malaterre

C

FAQ

  Q: Does OpenJPEG requires C99 compiler ?
  A: No
  Q: Are you sure OpenJPEG does not requires C99 compiler, because I see stdint.h in the source code
  A: Yes !

Description

OpenJPEG is meant to be portable. OpenJPEG should only requires ANSI C (C89) compilers.

Exceptions

Instead of re-inventing the wheel, OpenJPEG will use C99 notations in two occasions:

  • fixed-type notation
  • large file support

OpenJPEG uses two build-system: cmake & autotools. Both support system inspection and compiler detection. What happen in that:

  • iff compiler provide a stdint.h we will use it
  • iff compiler provide large file support we will use it

So in summary:

  • if your compiler does not provide a stdint.h we will emulate it using compiler private extension
  • if your compiler does not support Large File Support, you will not have support for LFS in OpenJPEG

Note: since we use type from stdint.h we will use the C99 notation PRIi64, PRIu64 & PRIx64 for printing the fixed 64 bits type. Again this is not a requirement on your compiler, we will use your compiler private extension as replacement if PRI?64 is not present.

Code Formating

Portability

File should be pushed to server with UNIX eol

Comment

Because OpenJPEG is written in C. One should use C style comment: /* and */

For doxygen, one should use /** and */

Open Questions

  • What charset to use for unicode ? UTF-8 is a good contestant. Eg: "Università" in comment
  • tab spaces ? indent ? uncrutify rule ?
  • file type (UNIX eol would be nice)

Sign in to add a comment
Powered by Google Project Hosting