Linux C++ safe header project

From: Linux Kernel Developer (linux_developer@hotmail.com)
Date: Tue Oct 24 2000 - 03:00:25 EST


Hi all,

    I'm looking through the suggestions and stuff that I have gotten so far.
As for the extern "C" stuff I'm torn between fixing the headers internally
or making side-by-side header files for C++ users. Such as:

a.h exists. So I create a a.hpp which contains somthing like the following:

a.hpp:

#ifndef __A_HPP__
#define __A_HPP__

#ifdef __cplusplus
extern "C" {
#endif

#include "a.h"

#ifdef __cplusplus
}
#endif

#endif

I'm not crazy about the second approach but open to it if the other one is
considered too intrusionary, a statement which I question considering the
$ifdef's leave the headers unchanged for C code.

As a first step in the project I've create a program that can be used to
update all the header files to include

#ifdef __cplusplus
extern "C" {
#endif

at the begining of each header file and

#ifdef __cplusplus
}
#endif

at the end of each header file. Said program is attached. Testers have
fun.

Note: this is only the first step to C++ safe header files. So please no
complaits about the C++ keywords. They still remain, for now.

- A. B.

begin 666 mkcppsaf.pl
M(R$O=7-R+V)I;B]P97)L"B,@4')O9W)A;2!N86UE.B!M:V-P<'-A9BYP; HC
M(%!R;V=R86UM960@:6XZ(%!E<FP@=C4N-BXP"B,@4')O9W)A;6UE9"!B>3H@
M02X@0BX*(R!0=7)P;W-E.B!4:&ES('!R;V=R86T@9FEX97,@0R!H96%D97(@
M9FEL97,@9F]R($,K*R!B>2!P;&%C:6YG(&%N(&5X=&5R;B B0R(*(R @(" @
M(" @("!W<F%P<&5R(&%R;W5N9"!T:&4@:&5A9&5R(&-O;G1E;G1S+B @5&AE
M(&5X=&5R;B B0R(@=W)A<'!E<B!I<R!O;FQY"B,@(" @(" @(" @96YA8FQE
M9"!F;W(@0RLK('1H<F]U9V@@=&AE(%]?8W!L=7-C<&QU<R!P<F5D969I;FET
M:6]N+@H*(R!#;W!Y<FEG:'0@,C P,"!!+B!"+BX@06QL(')I9VAT<R!R97-E
M<G9E9"X*"B,@3&%S="!M;V1I9FEC871I;VX@9&%T93H@,3 O,C0O,C P, HC
M(%9E<G-I;VXZ(# N,2XP"@HC($Y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T*"@DD9FEL92T^8VQO<V4H*3L*"@ES>7-T96TH<W!R:6YT9B@B
M;78@)7,@)7,N;W)G(BP@)&9N86UE+" D9FYA;64I*3L)(R!"86-K=7 @;W)I
M9VEN86P*"@EI9B@A9&5F:6YE9"@D9FEL92T^;W!E;B@D9FYA;64L($]?5U)/
M3DQ9('P@3U]#4D5!5"!\($]?5%)53D,I*2D*"7L*"0E35$1%4E(M/G!R:6YT
M9B@B56YA8FQE('1O(&]P96X@9FEL92 E<SH@)7-<;B(L("1F;F%M92P@)"$I
M.PH)"7)E='5R;B M,3L*"7T*"@DD9FEL92T^<')I;G1F*"(C:69D968@7U]C
M<&QU<W!L=7-<;B(I.PH))&9I;&4M/G!R:6YT9B@B97AT97)N(%PB0UPB('M<
M;B(I.PH))&9I;&4M/G!R:6YT9B@B(V5N9&EF7&XB*3L*"21F:6QE+3YP<FEN
M=&8H(EQN(BD["@DD9FEL92T^<')I;G1F*"(E<R(L("1D871A*3L*"21F:6QE
M+3YP<FEN=&8H(EQN(BD["@DD9FEL92T^<')I;G1F*"(C:69D968@7U]C<&QU
M<W!L=7-<;B(I.PH))&9I;&4M/G!R:6YT9B@B?5QN(BD["@DD9FEL92T^<')I
M;G1F*"(C96YD:69<;B(I.PH*"21F:6QE+3YC;&]S92@I.PH*"7)E='5R;B P
M.PI]"@HC(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C
I(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(R,C(PH`
`
end
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Oct 31 2000 - 21:00:13 EST