IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 21 years ago

Closed 21 years ago

Last modified 21 years ago

#471 closed enhancement (fixed)

header file C++ compatibility

Reported by: jhoblitt Owned by: eugene
Priority: high Milestone:
Component: IPP SDRS Version: unspecified
Severity: minor Keywords:
Cc: rhl@…

Description

Is this sufficient for general C++ compatability or are there other major concerns?

\subsection{C++ Compatibility}

All PSLib public header files should comptable with \code{C++}. This
primarily involves using \code{C} pre-processor directives to enable
\code{C++}'s \code{extern "C"} linkage specification when a header file is being
processed as part of a \code{C++} compilation.

An example of wrapping a header file with an \code{extern "C"} block:

\begin{verbatim}
#ifndef FOO_H
#define FOO_H 1

#ifdef cplusplus
extern "C" {
#endif

...

#ifdef cplusplus
}
#endif

#endif FOO_H
\end{verbatim}

Change History (4)

comment:1 by jhoblitt, 21 years ago

It appears that there are at least three potentional incompatabilties that may
apply to us. C++ users will have to to do some extra work to use pslib's
callbacks as function pointers use a different linkage in c++, there might be
problems with the Complex type(?), and trailing commas in enums might bite us.

enum Color { RED = 0, GREEN, BLUE, }; c++ 98 will barf

http://david.tribble.com/text/cdiffs.htm#C99-vs-CPP98

comment:2 by jhoblitt, 21 years ago

It looks like C++ doesn't understand pragmas either. We'll have to do protect
RHL's use of the poison pragma.

comment:3 by jhoblitt, 21 years ago

C++ doesn't understand restrict either but a quick grep suggests it's been
completely removed from pslib's header files.

comment:4 by eugene, 21 years ago

Resolution: fixed
Status: newclosed

this suggestion seems fine to me: i've added it to the SDRS

Note: See TracTickets for help on using tickets.