Closed jplatte closed 4 years ago
Good point. The idea is, that you have the actual type of your variable as a typedef by appending _type to the variable name. It is undocumented and I feel, that it is not too useful. Nowadays there are better C++11 features like the auto type for that.
I looked at it again and I've once changed that, so that the typedef is only used when needed. It is really needed when the type itself contains a comma like "std::map<int, int>". Then the macro do not work as needed. As I remember there was a problem when the typedef is used but I don't remember what the problem really was.
I checked what eccpc
would do when I added a variable std::basic_string<char, std::char_traits<char>>
(which is equivalent to std::string
). It used the typedef as the first argument for TNT_APPLICATION_SHARED_VAR
and compilation worked.
I think the typedef should just be used independently of whether the type has commas in it or not.
As I wrote ecpp uses the typedef when needed. An if the type itself has a comma, the typedef is used. Look at your generated cpp in your example. I'm sure you can see, that the typedef is used here.
See the code in tntnet at sdk/tools/ecppc/scopevar.cpp line 83. There ecppc checks whether a comma is found in the type.
Yeah of course I can see that. But it doesn't make any sense to generate the typedef unconditionally, and then only use it when needed. Either use it in every case, or only generate it when it's actually used.
This bit of ECPP
results is this generated C++
where the typedef isn't actually used. I suppose it's meant to be used as the first argument for
TNT_APPLICATION_SHARED_VAR
?