[janitor] programs/wcmd -Wwrite-strings cleanup

Daniel Marmier d.marmier at bluewin.ch
Thu Oct 9 15:58:24 CDT 2003


On Wed, 2003-10-08 at 21:58, Dimitrie O. Paun wrote:
> BTW, how far away are we from always compiling with -Wwrite-strings?

Well, much warnings are gone, but we're still some patches (and days)
away, because I started with the most obvious ones, and I am now running
into the less obvious.

Most of the remaining are about code that deals whith something external
(e.g. WIN32 function, commctl.h structure).

The brute force approach would be to always use variable strings in
those cases. However there are a number of cases where we know that the
string will be treated as constant. I do not like brute force, because:
- it is useless in these cases
- it makes the code less readable
- it makes the data more writable ...
- it will affect performance
- I hear them come, furious, shouting that my patches are bloatware

There has to be a better solution. Perhaps something like:

	#define FAKE_LPSTR(s) ((LPSTR)(ptrdiff_t)(s))

	WriteSpool16( physDev->job.hJob, FAKE_LPSTR(buf), strlen(buf) );

Where the intermediate cast to ptrdiff_t serves to shut-up gcc's
-Wcast-qual (which might be my one of my next candidates ...)

Or perhaps something really better ...

Comments, ideas, suggestions?

Best Regards,

				Daniel Marmier





More information about the wine-devel mailing list