winapi_check: Print a warning when 'long' is used in an API file as this type is not Win64 compatible.

Francois Gouget fgouget at free.fr
Fri Jan 26 11:21:54 CST 2007


---

When using a Microsoft compiler on a Windows 64 platform, 'long' is a 
32bit integer, while any sane compiler would say it's a 64bit integer. 
This means that even if an API prototype uses 'long' as a parameter we 
should not use this type. Instead we should use 'LONG' (or ULONG) which 
our headers make sure to always declare as a 32bit integer.

 tools/winapi/winapi.pm |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/winapi/winapi.pm b/tools/winapi/winapi.pm
index 8fcaa41..e5ed445 100644
--- a/tools/winapi/winapi.pm
+++ b/tools/winapi/winapi.pm
@@ -192,6 +192,10 @@ sub parse_api_file($$) {
 	    }
 	} elsif(defined($kind)) {
 	    my $type = $_;
+            if ($type =~ /^long\b/)
+            {
+                $output->write("$file:$linenum: type ($type) is not Win64 compatible\n");
+            }
 	    if(!$forbidden) {
 		if(defined($module)) {
 		    if($$allowed_modules_unlimited{$type}) {
-- 
1.4.4.3




More information about the wine-patches mailing list