Discussion:
Removing cruft from Windows code
Neil Hodgson
2014-01-12 22:51:33 UTC
Permalink
Over time various workarounds have been included in the code for build tools that included incomplete system headers. Since (almost) everyone is using more recent tools, this code has likely rotted without anyone noticing. It also causes problems with static testing tools.

So, some workarounds from 10 or more years ago have now been removed by this change set:
http://sourceforge.net/p/scintilla/code/ci/4d9978010c3a9ced9d65663be525086a470d1c45/
Anyone still using older build tools (Visual Studio <2008, gcc <4.7, or any other compiler) should check whether Scintilla still builds.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Florian Balmer
2014-01-17 05:58:22 UTC
Permalink
These changes do not cause any problems in my build system for Notepad2
(Visual Studio 2002, Version 7.0.9466).

However, compiling breaks with "error C2476: empty initializer list is not
allowed" for structs initialized with:

struct s = {};

instead of:

struct s = {0};

at the following locations:

Editor.cxx: lines 4434, 4444, 4462, 4469, 4479, 4485, 4498, 4510, 4522,
4535, 4546, 4554, 4599, 4616, 4624, 4633, 4825, 4967
ScintillaBase.cxx: lines 292, 328, 345, 437
PlatWin.cxx: line 211
ScintillaWin.cxx: line 2263

So I'd vote for switching back to the old notation here, if I may.

--Florian
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Mike Lischke
2014-01-17 08:20:59 UTC
Permalink
These changes do not cause any problems in my build system for Notepad2 (Visual Studio 2002, Version 7.0.9466).
Visual Studio 2002, really? We are at VS 2013 now! Backwards compatibility is often a good thing, but it can equally often be a really nasty burden...

Mike
--
www.soft-gems.net

Mike
--
www.soft-gems.net
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Neil Hodgson
2014-01-17 21:37:21 UTC
Permalink
These changes do not cause any problems in my build system for Notepad2 (Visual Studio 2002, Version 7.0.9466).
struct s = {};
Standard struct initialisation to 0 has been an ongoing portability issue with Scintilla and its been difficult to find a compromise that makes all the compilers happy.

While I have some sympathy for ensuring code works on old systems, Microsoft doesn’t support old versions of Windows with current compilers. Recent MinGW GCC does support old versions of Windows and it uses MSVCRT.DLL. If you don’t want to build Notepad2 with GCC, its possible to build SciLexer.DLL with GCC and use it from an application built with VS 2002.

Does VS 2002 compile this initialisation syntax?
LOGFONTW lf = LOGFONTW();

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Florian Balmer
2014-01-19 09:30:21 UTC
Permalink
Post by Neil Hodgson
Standard struct initialisation to 0 has been an ongoing portability issue
with Scintilla and its been difficult to find a compromise that makes all
the compilers happy.

I see, so there are C++ compilers that don't understand `struct s = {0};`?
Post by Neil Hodgson
If you don’t want to build Notepad2 with GCC, its possible to build
SciLexer.DLL with GCC and use it from an application built with VS 2002.

A nice feature about Notepad2 is that it's just one single executable file
without any dependencies, ready to run on any version of Windows, starting
from Windows 2000, the various (even old) WinPE descendants, and also
compatibility layers such as Wine, or ports like ReactOS. Not sure if this
could be achieved with a more recent compiler.
Post by Neil Hodgson
Does VS 2002 compile this initialisation syntax?
LOGFONTW lf = LOGFONTW();
Yes, that works fine.

--Florian
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Neil Hodgson
2014-01-19 21:48:32 UTC
Permalink
Post by Florian Balmer
I see, so there are C++ compilers that don't understand `struct s = {0};`?
There are compilers that display warnings for that code. Some build with options that treat warnings as errors.
Post by Florian Balmer
A nice feature about Notepad2 is that it's just one single executable file without any dependencies, ready to run on any version of Windows, starting from Windows 2000, ...
Building for Windows 2000 is supported by VC 2008.
http://msdn.microsoft.com/en-us/library/ws0swas0(v=vs.90).aspx

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Florian Balmer
2014-01-21 04:34:26 UTC
Permalink
Post by Neil Hodgson
There are compilers that display warnings for that code. Some build with
options that treat warnings as errors.

Ok, so no way back, here.

Would it be an option to use a macro to init empty structs, say
EMPTY_STRUCT(type,var), or INIT_STRUCT(type, var), or just EMPTY(type,var),
that could be redefined if needed? This could line up well with things like
CONTAINIG_RECORD(), or FIELD_OFFSET(), which have different definitions for
various compilers and platforms. But maybe this is not the right question
to be asked in a topic titled "removing cruft"?
Post by Neil Hodgson
Building for Windows 2000 is supported by VC 2008.
I'll have to evaluate this, probably.

--Florian
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Neil Hodgson
2014-01-21 22:14:14 UTC
Permalink
Would it be an option to use a macro to init empty structs, say EMPTY_STRUCT(type,var), or INIT_STRUCT(type, var), or just EMPTY(type,var), that could be redefined if needed?
That would be quite ugly. Using '= {}’ is the technique being promoted these days since it is applicable over all types and doesn’t repeat type information.
Post by Neil Hodgson
Building for Windows 2000 is supported by VC 2008.
I'll have to evaluate this, probably.
It should be possible to download Visual C++ 2008 Express from
http://www.microsoft.com/en-us/download/details.aspx?id=10986

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/groups/opt_out.
Loading...