[M3devel] a "need" for multi-pass m3cg (or different order of calls)

Jay K jay.krell at cornell.edu
Thu Sep 6 10:40:46 CEST 2012


/* The following is legal C but not C++: */

struct Foo_t;typedef struct Foo_t Foo_t;static struct Foo_t Foo; /* illegal C++; C forward/tentative definition */
int F1(void) { return *(int*)&Foo; }
struct Foo_t { int i; };static Foo_t Foo = { 123 };

This is a reason that either1) I "need" to make M3C.m3 "multi pass"2) or at least buffer everything in memoryin multiple pieces and then concat at the end

  I could also make it less efficient:  

  struct Foo_t; /* segment */   typedef struct Foo_t Foo_t;    static struct Foo_t * /*const*/ Foo;  

  int F1(void) { return *(int*)&Foo; }  

  struct Foo_t { int i; };  static Foo_t _Foo = { 123 };    static Foo_t* /*const*/ Foo = &_Foo;
But that seems unfortunate.

I will want to generate C++ at some point, for efficient portable exceptionhandling. But that comes later.

Also later, the C code needs a reordering in order to refer to fields in "segments".

 - Jay 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20120906/741db7f7/attachment-0001.html>


More information about the M3devel mailing list