Re: Error in header files in C++

"Lionel Flandrin" <[email protected]>
Newsgroups gmane.comp.video.videolan.libdvbpsi.devel
Message-ID <189b34150609192222q204bbccat615d49054b578e5b__1722.50578548319$1158729772$gmane$org@mail.gmail.com>
On 9/20/06, Peter M. Groen <[email protected]> wrote:
> This should be a hint ;)
>
> #ifdef __cplusplus
>
> Classes are ended with a semicolon. Or you'll discover some other compiler
> errors like : "double declaration of....." etc..

I know that's not the end of a class declaration, that's the end of

 #ifdef __cplusplus
 extern "C" {
 #endif

//C header file

 #ifdef __cplusplus
 } // no semicolon here
 #endif

It's just to tell compiler to use C-style object linkage when using
this header in C++
(to forbid C++ name mangling which would result in errors at link time)

You can check here:
http://en.wikipedia.org/wiki/Name_mangling
I quote:

Handling of C symbols when linking from C++

The job of the common C++ idiom:

#ifdef __cplusplus
extern "C" {
#endif
    /* ... */
#ifdef __cplusplus
}
#endif

end of quote

as you can see, no semicolon here
-- 
Lionel Flandrin

-- 
This is the libdvbpsi-devel mailing-list, see http://developers.videolan.org/
To unsubscribe, go to: http://developers.videolan.org/lists.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.