|
From: Gisle V. <gv...@ya...> - 2015-03-23 14:59:32
|
Keith Marshall wrote:
> My chosen alternative is attached: I elected to use a quoted include,
> rather than the bracketed form.
Good choice.
BTW. I also made a quick GNU makefile targeting MSVC v18 (attached).
Your use of an variable-sized array is still not supported in MSVC v18
(A C99/C++11 feature). So I patched wtkchild.cpp like:
+++ ./wtkchild.cpp 2015-03-23 13:55:24 +0000
@@ -41,6 +41,7 @@
#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
+#include <string.h>
#include "wtklite.h"
namespace WTK
@@ -60,8 +61,8 @@
/* On failure, compose diagnostic message, and bail out.
*/
const char *fmt = "%s: CreateWindow FAILED";
- char description[1 + snprintf( NULL, 0, fmt, ClassName )];
- snprintf( description, sizeof( description ), fmt, ClassName );
+ char *description = (char*) alloca (strlen(fmt) + strlen(ClassName) + 1);
+ sprintf( description, fmt, ClassName );
throw( runtime_error( description ) );
}
/* On success, return the window handle.
I think alloca() is ~100 times faster than snprintf() on any compiler.
MSVC also needed this:
--- wtklite-orig/sashctrl.cpp 2013-08-19 11:24:17 +0000
+++ ./sashctrl.cpp 2015-03-23 13:57:43 +0000
@@ -151,6 +151,7 @@
*/
WindowObjectReference( GetParent( AppWindow ))->AdjustLayout();
}
+ return (1);
}
MSVC++ complained about "must return a value". But I'm not sure the significance
of the ret-val.
--
--gv
|