Solved Error: Wrong indentation of namespace member

Hello,

I use namespaces a lot, and I indent the code within the namespace scope. That also how Xcode auto-formats it.

In one of my projects, this works fine:
no-indentationerrors.jpeg

In another one, it throws errors that can only be "fixed" by not indenting the code. That really annoys me.
indentationerrors.jpeg

Both projects were created with the R23 Project Tool, and both projectdefinition.txt look like this (except for the ModuleId, of course):

// Supported platforms - can be [Win64;OSX]
Platform=Win64;OSX

// Type of project - can be [Lib;DLL;App]
Type=DLL

// API dependencies
APIS=core.framework;cinema.framework;mesh_misc.framework;math.framework;

// C4D component
C4D=true

stylecheck.level=3 // must be set after c4d=true
stylecheck.aswarnings=false
stylecheck.max-linecount=300

// Custom ID
ModuleId=de.frankwilleke.dim4nsions

Why do these projects behave different?
Thanks in advance!

Cheers,
Frank

www.frankwilleke.de
Only asking personal code questions here.

hi,

The answer from the dev.

We use indentation for namespaces which start with an upper case letter and no indentation for namespaces with a lower case letter.
Namespaces starting with lower case are used for code, and there we don't use indentation to avoid excessive indentation of the code.
Screen space is precious there! Namespaces starting with upper case are used for grouping simple entities such as

namespace FileFormats
{
       MAXON_DECLARATION(FileFormat, Browsable, "net.maxon.fileformat.browsable");
       MAXON_DECLARATION(FileFormat, File, "net.maxon.fileformat.file");
       MAXON_DECLARATION(FileFormat, MaxonDocumentBinary, "net.maxon.fileformat.maxondocumentbinary");
       MAXON_DECLARATION(FileFormat, MaxonDocumentJson, "net.maxon.fileformat.maxondocumentjson");
       MAXON_DECLARATION(FileFormat, MaxonDocumentXml, "net.maxon.fileformat.maxondocumentxml");
}

And that's your case.

Cheers,
Manuel

MAXON SDK Specialist

MAXON Registered Developer

Hi Frank,

not sure if it is the culprit, but in your working version you have an empty line at the beginning of the namespace scope and in the version where it does not work, you have these not.

Cheers,
Ferdinand

MAXON SDK Specialist
developers.maxon.net

I also thought about this. But it doesn’t change the errors. Neither do normal or doxy comments.

At the bottom of the second screenshot you can see that the next function also gets the error, and so does everything in the namespace scope.

www.frankwilleke.de
Only asking personal code questions here.

Are both header files or is the upper one a cpp file?
Also, do the errors com from Intellisense or is it a style check/compilation error?

If the LLVM convention is used, the error is correct. LLVM namespace formatting conventions don't use any intentaion. You might be a able to fix this by ignoring this error explicitly.
It also might be caused by a bug in XCode.

Hi Frank,

we will discuss your thread tomorrow, this was just me "shooting from the hip" ;) I am also not sure if we are talking about the same thing, so I meant this:

1.png

Cheers,
Ferdinand

MAXON SDK Specialist
developers.maxon.net

hi,

I did contact our dev, it seem to be a bug in our source processor.
In any case, you can specify the following in the projectdefinition.txt if you want to use your own indentation:

stylecheck.indentation=false

Remember there's a lot of option you can set or not in the projection definition, see our documentation.

Cheers,
Manuel

MAXON SDK Specialist

MAXON Registered Developer

Thanks! Yeah, that would’ve been my solution, too. I just wonder why the error occurs in the first place. In the project where the error doesn’t come up, I didn’t set that option, so there has to be a difference somewhere, and I wanted to know why.

Anyway, I’ll just suppress it ;-) thank you.

Cheers,
Frank

www.frankwilleke.de
Only asking personal code questions here.

hi,

The answer from the dev.

We use indentation for namespaces which start with an upper case letter and no indentation for namespaces with a lower case letter.
Namespaces starting with lower case are used for code, and there we don't use indentation to avoid excessive indentation of the code.
Screen space is precious there! Namespaces starting with upper case are used for grouping simple entities such as

namespace FileFormats
{
       MAXON_DECLARATION(FileFormat, Browsable, "net.maxon.fileformat.browsable");
       MAXON_DECLARATION(FileFormat, File, "net.maxon.fileformat.file");
       MAXON_DECLARATION(FileFormat, MaxonDocumentBinary, "net.maxon.fileformat.maxondocumentbinary");
       MAXON_DECLARATION(FileFormat, MaxonDocumentJson, "net.maxon.fileformat.maxondocumentjson");
       MAXON_DECLARATION(FileFormat, MaxonDocumentXml, "net.maxon.fileformat.maxondocumentxml");
}

And that's your case.

Cheers,
Manuel

MAXON SDK Specialist

MAXON Registered Developer

Wow, I never thought of that.
Very good to know, thank you for asking! :-)

Cheers & have a nice weekend,
Frank

www.frankwilleke.de
Only asking personal code questions here.