>>>> "kkm" == Kirill 'Big K' Katsnelson
<kkm(a)dtmx.com> writes:
kkm> I compiled XEmacs with a C++ compiler yesterday night, and it pointed
kkm> me to this bug (":warning: Empty control statement. Is ';' in
intended place?")
kkm> Same error is also present somewhere in DND code. Patch follows.
kkm> I think that C++ compile is a very good idea.
I've found several bugs this way.
Because autoconf and lib-src are not C++-clean, you need to compile
with a C compiler and a C++ compiler.
With configure, use the undocumented
env XEMACS_CC=/msc/c++ configure ...
With Windows native, you are breaking new ground. I would guess
normal make with C compiler;
(cd lwlib; make clean;)
(cd src; make clean;)
make CC=/msc/c++
would work.
kkm> A question. I have fixed all errors and warnings which C++ compiler gave,
kkm> except for conversion errors between char* and unsigned char*. This is
kkm> an error in C++:
kkm> unsigned char str[20];
kkm> strset (str, 'z', 19);
kkm> I do not really want to use casts at such places - they certainly do not
kkm> improve on readability of the code. Any luck avoiding these?
I know how you feel. But I think you should fix those, because:
- this is an ERROR, and we'd like to do things like USE the
C++-compiled code, especially for `make check' and performance
hacking.
- this is generally a WARNING under C, so these should be fixed
anyways; not just for C++.
- I think it was a mistake to have typedef'ed Extbyte, Bufbyte,
etc. as `unsigned char', despite the added safety of consistent
signedness of chars. So there are many casts for (char *) to
(Bufbyte *), etc...
_If_ we are serious about avoiding warnings and avoiding casts, then
we should create a collection of string handling function versions
of the functions taking (char *) args.
INLINE size_t Extlen (Extbyte *p) { return strlen ((char *) p); }
INLINE size_t Buflen (Bufbyte *p) { return strlen ((char *) p); }
INLINE size_t ustrlen (unsigned char *p) { return strlen ((char *) p); }
...
etc...
...
This is my kind of thing, and is something the project could agree
to do. But it will be a major global code change with no direct
user benefit... In fact, actual users would suffer from slightly
longer compile times...
Anyways, I recommend, for now, doing the distasteful
strset ((unsigned char *) str, 'z', 19);
Martin
P.S. I don't know what `strset' is, but I could guess and suggest
str[19] = 'z';