> * Paul Eggert <[EMAIL PROTECTED]> [2005-08-23 13:35:05 -0700]: > > Sam Steingold <[EMAIL PROTECTED]> writes: > >> c++ is stricter, so if the code can be compiled with c++ it is probably >> safer. > > That doesn't match my experience. To make C code work with C++, I > often have to introduce casts (e.g., to convert void * to char *, or > to convert one integer type to another). These casts reduce > reliability, since they can mask real problems when they are done > incorrectly. As a general rule I therefore prefer C code to have as > few casts as C allows. > > I don't use C++, so I'll need your help here. Is there some simple > way that we can work around this in the regex code, without having to > make wholesale changes? For example, can we surround all the code > with extern "C" { ... } when compiling with C++?
I just looked at the first couple of errors: In file included from regex.c:85: regex_internal.c: In function `reg_errcode_t re_string_construct(re_string_t*, c onst char*, int, char*, int, const re_dfa_t*)': regex_internal.c:97: error: invalid conversion from `int' to `reg_errcode_t' regex_internal.c: In function `reg_errcode_t re_string_reconstruct(re_string_t*, int, int)': regex_internal.c:720: error: invalid conversion from `int' to `reg_errcode_t' a superficial code examination shows that these are indeed bugs in regex: build_wcs_upper_buffer should be declared to return reg_errcode_t and not int. I suspect this is the case elsewhere too. -- Sam Steingold (http://www.podval.org/~sds) running w2k <http://www.memri.org/> <http://ffii.org/> <http://www.palestinefacts.org/> <http://truepeace.org> <http://www.mideasttruth.com/> <http://www.dhimmi.com/> Stupidity, like virtue, is its own reward. _______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib