#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Sat, 01 Oct 2016 12:26:19 +0200
changeset 20489 413138df0173
parent 20488 3743c00c7735
child 20490 f1c27208211f
#FEATURE by cg class: ExternalBytes added: #sizeofEnums
ExternalBytes.st
--- a/ExternalBytes.st	Fri Sep 30 17:58:59 2016 +0200
+++ b/ExternalBytes.st	Sat Oct 01 12:26:19 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -650,6 +648,20 @@
     "
 !
 
+sizeofEnums
+    "return the number of bytes used by the machine's native enums.
+     Be aware, that this can be adjusted in some compilers via the __packed__ attribute;
+     So better double check..."
+
+%{  /* NOCONTEXT */
+    enum foo { bla1, bla2 } foo;
+    RETURN (__mkSmallInteger( sizeof(foo)));
+%}
+    "
+     ExternalBytes sizeofEnums
+    "
+!
+
 sizeofFloat
     "return the number of bytes used by the machine's native floats"