On 07/02/2015 13:38, Bram Moolenaar wrote:
Mike Williams wrote:
On 04/02/2015 16:19, Ben Fritz wrote:
It looks like I need to enable some compiler warning options on my
Windows build setup at home. :-(
Just turned up MSVC build from W3 to W4. I had to turn off a bunch of
warnings through vim.h for the usual C coding slackness, but doesn't
catch them all since not all files include vim.h. See attached diff for
details.
The build with VC11 throws up a pile more potentially un-intialised
before use variables, amongst a few other C hacks used in VIM that may
or may not be important to address. I doubt VIM will ever default to W4
when building, but it is good to go through the exercise once in a while
to clean the worst things up, and then fall back to W3.
There is enough there to come a few people busy for a while so just dive
into issues you see.
I guess that compilers throw more warnings to avoid mistakes in C
programs, even though the code is OK. I can include that patch, but I
don't think we can avoid some warnings without taking a penalty in
performance.
I have looked through the potentially uninitialised variables reported
for my usual Windows builds and they all look benign. It seems the
compiler is just spotting branches in the code where the variable is not
assigned to but is used later. A simplistic example is:
int foo, bar;
if (a)
foo = bar;
else
bar = 1;
if (a)
bar += 2*foo;
This generates a warning since it doesn't spot that foo is initialised
and referenced under the same condition. There are various approaches
that can be made to remove the warnings from simple initialisation
through code refactoring.
The other common warning is for function and data pointer conversions.
In standard C a function pointer is not compatible with void * but
typically doesn't cause a problem, so not worth worrying about.
Based on this I don't see any point in using W4 with Visual C, you just
get a pile of warnings you wont ever clear up.
There may be more used in looking at the output from ANALYZE=yes with
VC. More code reading ...
Mike
--
My computer's sick and I think my modem is a carrier.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.