Compilation doesn't succeed for K&R style blocks
I've just started using VUEngine, this is incredibly impressive! I especially like how you've set up a transpiler that allows for object-oriented programming while still targeting C.
I was trying to set up a barebones test class, and was noticing weird errors in the log like "unused field" and "_this" not defined. I couldn't figure out what the issue was for the life of me, so I kept tweaking my code until it looked like the code from the sample project. These errors only finally went away when I switched from using K&R style blocks (I personally find these more readable) to Allman style blocks, i.e. from:
while (x == y) {
foo();
bar();
}
to
while (x == y)
{
foo();
bar();
}
Ideally, the transpiler should work regardless of how the lines are formatted, so I wanted to report this as a minor issue.
Keep up the good work, excited to see your future developments on VUEngine and VUEngine Studio!
Heya, thanks!
Actually, that behavior is expected, although not ideal and definitively not well documented. Having said that, I tried to replicate it by using K&R style both in header files, method definitions and inside functions and, contrary to my expectations, I was not able to reproduce the error. All of the following compiled without trouble:
// WireframeManager.h: singleton class WireframeManager : ListenerObject {
/// @protectedsection
// WireframeManager.c: void WireframeManager::reset(){
WireframeManager::enable(this);
// WireframeManager.c: void WireframeManager::reset(){
WireframeManager::enable(this);
// WireframeManager.c: Wireframe WireframeManager::createWireframe(const WireframeSpec* wireframeSpec, SpatialObject owner){ NM_ASSERT(NULL != wireframeSpec, "WireframeManager::createWireframe: null wireframeSpec");
if(NULL == wireframeSpec){
return NULL;
}
Are you using the version of the engine provided with VUEngine Studio or are you cloning it from its repo? While I don't remember explicitly adding support for K&R style blocks, this might have been addressed by other fixes in the last couple of weeks since I'm unable to reproduce these -expected- errors.
Actually, I just have been able to reproduce it. Will try to make it work.
Thanks for reporting!