Any reason *not* to make this change:

Index: include/parrot/string.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/string.h,v
retrieving revision 1.59
diff -d -u -r1.59 string.h
--- include/parrot/string.h     22 Apr 2004 08:55:06 -0000      1.59
+++ include/parrot/string.h     11 Jun 2004 09:46:36 -0000
@@ -54,7 +54,7 @@
 #define STRINGINFO_STRLEN   6
 
 /* &end_gen */
-#define STRING struct parrot_string_t
+typedef struct parrot_string_t STRING;
 
 #endif /* PARROT_IN_CORE */
 #endif /* PARROT_STRING_H_GUARD */



Witness the pain that using the pre-processor causes:

(gdb) down
#0  0x00034114 in char8_at (offs=12, context=0xb003f850) at src/string.c:2918
2918        return ((char*)((STRING *)context)->strstart)[offs];
(gdb) print (STRING *)context)
No symbol "STRING" in current context.


followed by swearing and cursing and time wasted grepping to find out what
a STRING is.

Is there any reason not to have a coding standard that typedef should be
used whenever possible (and non-uses must have their reason commented?)

Nicholas Clark

Reply via email to