[1.7.2] Ogre::String instead String in StringUtil

Minor issues with the Ogre API that can be trivial to fix
Hubert
Kobold
Posts: 25
Joined: Mon Feb 09, 2009 10:48 am
Location: Belgium
x 1

[1.7.2] Ogre::String instead String in StringUtil

Post by Hubert »

file : OgreString.h

Methods don't specify "Ogre::" except 2 functions :

Code: Select all

		static void splitFullFilename(const Ogre::String& qualifiedName, 
			Ogre::String& outBasename, Ogre::String& outExtention, 
			Ogre::String& outPath);

		static void splitBaseFilename(const Ogre::String& fullName, 
			Ogre::String& outBasename, Ogre::String& outExtention);
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5433
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1341

Re: [1.7.2] Ogre::String instead String in StringUtil

Post by dark_sylinc »

You're suggesting that all functions should use "Ogre::String", or that those two functions should use "String"?

I personally prefer Ogre::String, since once I copy paste the function from the header into my code, they have the "Ogre::" namespace already in it.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: [1.7.2] Ogre::String instead String in StringUtil

Post by jacmoe »

IMO, it's bad to be using any namespace in headers.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5433
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1341

Re: [1.7.2] Ogre::String instead String in StringUtil

Post by dark_sylinc »

jacmoe wrote:IMO, it's bad to be using any namespace in headers.
Never heard arguments against or in favour of it (I'm not saying there aren't). Except for "using namespace <xx>"; which is really really bad in headers.
I do agree putting unnecessary "Ogre::" clutters the reading of code, but it may be useful when a specific utility function gets copy pasted too much from the header IMHO.
CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 58

Re: [1.7.2] Ogre::String instead String in StringUtil

Post by CABAListic »

Not entirely sure about that, but explicitly specifying the namespace that you're in might screw up the lookup in some rare and obscure cases. Either way, not using the Ogre namespace from inside is very likely the standard in the code base, so if you really want to make it consistent, then remove it.
But this has no effect on anything, so unless it's really just this isolated case, it might not be worth the trouble.