cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX violates global namespace standard

j o
Associate II

All declarations in the global namespace that start with an underscore are reserved by the C++ compiler according to the C++ standard. See: https://en.cppreference.com/w/cpp/keyword

TouchGFX violates this by converting any images to "_filename" and having them in the global namespace. I was made aware of this when an image with the name "start" was colliding with the compiler's defined value of _start.

This should be fixed as soon as possible.

1 ACCEPTED SOLUTION

Accepted Solutions
Martin KJELDSEN
Chief III

Hi @j o​,

You're right. If an image asset starts with an upper-case letter, the resulting symbol is reserved according to the c++ standard. It's never been an issue for us or anyone else (that i know of), but there's a task in our system to fix this in the image converter tool.

So, you could say that TouchGFX allows the user to violate the standard, depending on how assets are named, yes.

Thanks for highlighting it =)

/Martin

View solution in original post

3 REPLIES 3
Martin KJELDSEN
Chief III

Hi @j o​,

You're right. If an image asset starts with an upper-case letter, the resulting symbol is reserved according to the c++ standard. It's never been an issue for us or anyone else (that i know of), but there's a task in our system to fix this in the image converter tool.

So, you could say that TouchGFX allows the user to violate the standard, depending on how assets are named, yes.

Thanks for highlighting it =)

/Martin

j o
Associate II

Hi Martin,

I'd like to clarify, that *in the global namespace* (which this is) any leading underscores whether they are followed by upper-case or not, are in violation. The leading underscore can't be used *anywhere* if a capital letter follows. See the following quote from the linked site (emphasis mine):

"Also, all identifiers that contain a double underscore __ in any position and each identifier that begins with an underscore followed by an uppercase letter is always reserved and all identifiers that begin with an underscore are reserved for use as names in the global namespace. See identifiers for more details."

Regards,

Jeremy

Martin KJELDSEN
Chief III

I think we'll prioritize this since it's a quick fix, tests pending. Will bundle it as a "tool patch" with a fix to the fontconverter that's already in the "known issues".