Re: [Linux-NTFS-Dev] C++ - compatible headers
Development moved to https://sourceforge.net/projects/ntfs-3g/
Brought to you by:
antona,
cha0smaster
From: Anton A. <ai...@ca...> - 2007-08-31 19:43:30
|
On 31 Aug 2007, at 18:05, Yura Pakhuchiy wrote: > On Sun, 15 Jul 2007 at 17:22 +0200, Bogdan wrote: >> Since libntfs is a development library and anyone can use functions >> from it by including header files, these header files should be >> compatible with the C++ language, not only with C. This is achieved >> easily by adding the following lines to the files: >> >> #ifdef __cplusplus >> extern "C" { >> #endif >> >> /* function declarations go here */ >> >> #ifdef __cplusplus >> } >> #endif > > libntfs is C library and why we should add this ugly defines to every > header? If you want use libntfs from C++ then just write: I have no objections to the C++ header guards being added. Can we please have it with __BEGIN_DECLS and __END_DECLS around function declaration blocks, please? That is a lot less ugly. I suggest to do it in ntfs.h, i.e. add detection of <sys/cdefs.h> to configure.ac and in types.h do #ifndef HAVE_SYS_CDEFS_H #if defined(__cplusplus) #define __BEGIN_DECLS extern "C" { #define __END_DECLS } #else #define __BEGIN_DECLS #define __END_DECLS #endif #endif Then we just have to make sure we include our types.h in all our header files to make sure we always have __BEGIN_DECLS and __END_DECLS available. Bogdan, care to submit a patch? Best regards, Anton -- Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK Linux NTFS maintainer, http://www.linux-ntfs.org/ |