Trivia: Irrlicht source's coding style

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
biloon
Posts: 1
Joined: Sat Nov 12, 2011 11:02 am

Trivia: Irrlicht source's coding style

Post by biloon »

I recently read through Irrlicht source code, and I really like the coding style used, especially the comment style. I wonder if there are guidelines to those coding styles for me (Honestly, I would love to adopt it, because my coding pattern is somewhat radical and chaotic).

Thanks
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: Trivia: Irrlicht source's coding style

Post by Radikalizm »

biloon wrote:I recently read through Irrlicht source code, and I really like the coding style used, especially the comment style. I wonder if there are guidelines to those coding styles for me (Honestly, I would love to adopt it, because my coding pattern is somewhat radical and chaotic).

Thanks
The coding style irrlicht uses is pretty much the recommended way to program in an object-oriented environment, separating the interface of a class from its implementation (with some exceptions to make the devs' lives somewhat easier, like in the ISceneNode class)
Having good knowledge of object-oriented programming and the concepts behind it should give you enough information to maintain this coding style, and I would really suggest picking up some reading material if you want to study it in somewhat more in depth (I can recommend Object-Oriented Software Construction by Bertrand Meyer)

The commenting format used is determined by doxygen, which is the documentation application used to generate the API reference for the engine
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Trivia: Irrlicht source's coding style

Post by hendu »

I found it ugly, mainly in the placement of {} () [] and the extra spacing inside those. I much prefer the linux kernel style with regard to those parts.

The interface/class separation is not a coding style question, IMHO.
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: Trivia: Irrlicht source's coding style

Post by Radikalizm »

hendu wrote:The interface/class separation is not a coding style question, IMHO.
You'd be amazed at how many people don't know about this ;)
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Trivia: Irrlicht source's coding style

Post by CuteAlien »

hendu wrote:I found it ugly, mainly in the placement of {} () [] and the extra spacing inside those. I much prefer the linux kernel style with regard to those parts.
Unfortunately it's impossible to please everyone with the bracket style - you either love it or hate it :-) But the Allman style used in Irrlicht is the prevalent bracket style used in c++ coding while the one true bracket style of the Linux kernel is probably more common in c.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Trivia: Irrlicht source's coding style

Post by ACE247 »

Was almost about to say that linux kernel style wouldnt help you much with c++. Looks like someone beat me too it though. :) And yeah the Allman style is prob the best.
But these are just styles anyway, so go invent a new one! :D Well one that works and doesn't just look funky...
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Trivia: Irrlicht source's coding style

Post by hendu »

@ACE247

I'm missing the point in how bracket placing can help in c++ :P
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Re: Trivia: Irrlicht source's coding style

Post by BlindSide »

Hey man there are some rules outlined in the FAQ:

http://irrlicht.sourceforge.net/faq.html#rules
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
ACE247
Posts: 704
Joined: Tue Mar 16, 2010 12:31 am

Re: Trivia: Irrlicht source's coding style

Post by ACE247 »

@Hendu It keeps your mind from drifting when reading code, particularly code you wrote a long time ago... ;)
martinluither
Posts: 1
Joined: Tue Oct 29, 2013 11:05 am

Re: Trivia: Irrlicht source's coding style

Post by martinluither »

Make sure that you start by contributing something which is comparatively small like fixing a bug. The next fact is that don’t use the STL, use the Irrlicht built in containers instead.Make sure that you don’t use special compiler extensions.
Post Reply