With the recent discussion of the Scintilla namespace in Scintilla.h, there are a couple of other issues that could be improved.
#define X Sci_X:
When the structs received “Sci_” prefixes in 2009, the intention was to later remove the old names which are more likely to clash with application names. These currently have #defines:
#define CharacterRange Sci_CharacterRange
#define TextRange Sci_TextRange
#define TextToFind Sci_TextToFind
#define RangeToFormat Sci_RangeToFormat
#define NotifyHeader Sci_NotifyHeader
The original thread about “branding structs”:
https://groups.google.com/d/topic/scintilla-interest/sodUr-UU1W0/discussion
I’d like to remove these #define statements. They will first move into an #ifdef INCLUDE_DEPRECATED_FEATURES section like old APIs for a release or two before disappearing completely.
uptr_t and sptr_t:
These typedefs are very old with the current versions from 2001/2002. The C99 language standard has intptr_t and uintptr_t available from stdint.h. Unfortunately Microsoft put these definitions in stddef.h as there was no stdint.h in VS2008 or the original release of VS2010. The replacement code could look like:
/* Define uptr_t, an unsigned integer type large enough to hold a pointer and
* sptr_t, a signed integer large enough to hold a pointer. */
#if defined(_MSC_VER)
// Older releases of MSVC did not have stdint.h.
#include <stddef.h>
#else
#include <stdint.h>
#endif
typedef uintptr_t uptr_t;
typedef intptr_t sptr_t;
When support is dropped for older versions of Visual C++, the conditional includes could be changed to just #include <stdint.h>.
Neil