Hi -

If you say, for example,

 extern type c_char = int(8);
 var x:c_char;

then by the time the code is generated, we get

 int8_t x_chpl;

which causes problems in a variety of extern integration
contexts. We want it to say rather:

 char x_chpl;


The question is - what do we need to do in order to fix it?

I think that we need to do the following, but I wanted
to ask if there is another simpler approach?

- add a normalizedType* to the Type class
- the compiler would generate 2 types where it used to do one:
 -- Type for int(8) which would have normalizedType=this
 -- Type for c_char with normalizedType = int(8)
- fix some or all Type* equality checks (possibly with C++ overload of ==)
  to check normalizedType instead of Type*
- make sure that function resolution instantiates with the original Type
  instead of the normalizedType (e.g. so that c_ptr(c_char) ends up
  generating as char* rather than int8_t*), even as it uses the
  normalized type when deciding how to instantiate.

Note that in some cases that would mean we would need to generate
two functions where we used to do only one:

 proc writeln(x) // if this is used with c_char and int(8), we need
 
 proc writeln(x:c_char)
 proc writeln(x:int(8))



Is that a good approach? Are there better ideas?

Thanks,

-michael


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to