Difference between revisions of "C plus plus version"

From WikiManual
Jump to: navigation, search
Line 1: Line 1:
 
Original document (and comments)  by Taldor in black, comments by Numsgil in <font color="Red">Red</font>.
 
Original document (and comments)  by Taldor in black, comments by Numsgil in <font color="Red">Red</font>.
  
I propose we discuss the C++ design and coding standards in here. A wiki is much handier then a forum or PM's for it.--[[User:Taldor Taldor]]
+
I propose we discuss the C++ design and coding standards in here. A wiki is much handier then a forum or PM's for it.--[[User:Taldor|Taldor]]
  
 
== Language switch ==
 
== Language switch ==
  
 
You wonder why we're switching? Because VB is for simple, gui based programs. Darwinbots is nor a simple program, nor gui based. In contrary C++ is a powerfull language, but it has a higher development cost.  
 
You wonder why we're switching? Because VB is for simple, gui based programs. Darwinbots is nor a simple program, nor gui based. In contrary C++ is a powerfull language, but it has a higher development cost.  
 +
 +
[http://en.wikipedia.org/wiki/Visual_basic#Controversy Visual Basic controvercy]
  
 
== C++ design ==
 
== C++ design ==
Line 34: Line 36:
 
== C++ coding standards ==
 
== C++ coding standards ==
  
I would use:
+
# C++ <font color="Red"> C++ libraries where such libraries do what I want them to do, C libraries otherwise.  Another value decision. </font> All C librairies are included in C++. Mixing C and C++ isn't the easiest task, however OO C++ and procedural C++ can be mixed easily. <font color = "Red"> I agree, but I've been having some trouble with various C++ libraries that immediatly goes away when I switch to the C versions.  Might just be my compiler MSVC++ 6.0</font>
#C++ <font color="Red"> C++ libraries where such libraries do what I want them to do, C libraries otherwise.  Another value decision. </font> All C librairies are included in C++. Mixing C and C++ isn't the easiest task, however OO C++ and procedural C++ can be mixed easily. <font color = "Red"> I agree, but I've been having some trouble with various C++ libraries that immediatly goes away when I switch to the C versions.  Might just be my compiler MSVC++ 6.0</font>
+
# Four spaced tabs - <font color="Red"> Aye. </font>
#Four spaced tabs - <font color="Red"> Aye. </font>
+
# External librairies when possible (ie. [http://www.boost.org/ Boost]) <font color="Red"> Internal libraries where possible, to decrease the number of code dependancies, except where external libraries perform the job faster/more comoprehensively than internal libraries can. </font>
#External librairies when possible (ie. [http://www.boost.org/ Boost]) <font color="Red"> Internal libraries where possible, to decrease the number of code dependancies, except where external libraries perform the job faster/more comoprehensively than internal libraries can. </font>
+
# [http://www.libsdl.org SDL] <font color="Red"> Dunno, haven't looked into graphics libraries yet. </font>
#[http://www.libsdl.org SDL] <font color="Red"> Dunno, haven't looked into graphics libraries yet. </font>
+
# [http://www.fox-toolkit.org Fox Toolkit]
#...
+
# [http://www.opengl.org OpenGL]
  
 
== See also ==
 
== See also ==
Line 46: Line 48:
 
# [http://www.cppreference.com C/C++ Reference]
 
# [http://www.cppreference.com C/C++ Reference]
 
# [http://www.parashift.com/c++-faq-lite C++ FAQ Lite]
 
# [http://www.parashift.com/c++-faq-lite C++ FAQ Lite]
# [http://en.wikipedia.org/wiki/Visual_basic#Controversy Visual Basic controvercy]
 

Revision as of 18:16, 30 October 2005

Original document (and comments) by Taldor in black, comments by Numsgil in Red.

I propose we discuss the C++ design and coding standards in here. A wiki is much handier then a forum or PM's for it.--Taldor

Language switch

You wonder why we're switching? Because VB is for simple, gui based programs. Darwinbots is nor a simple program, nor gui based. In contrary C++ is a powerfull language, but it has a higher development cost.

Visual Basic controvercy

C++ design

General concepts

  • Class based approach. In some cases, procedural in others. It's a value decision I'll make as I port the code.
  • Portable code. Where possible. Preferably in house or free library wrappers for non portable functions, such as multithreading and OS timers.

Structure

See the present VB code

  • Main
    • User Interface (Fox Toolkit)
      • Simulation sub window (3D - OpenGL)
    • Darwin (the simulation engine)
      • Veg
      • Tie
      • Robot
        • Sense

To be used everywhere:

  • Vector_4 (using uBLAS) Present vector class is from this article. I'll use whichever is fastest, feel free to perfrom benchamrks
  • Matrix_4 (also using uBLAS) See above
  • Random (using 'srand()' and 'rand()') See the chapter on random numbers
  • Object (the base class) Depends on the class

C++ coding standards

  1. C++ C++ libraries where such libraries do what I want them to do, C libraries otherwise. Another value decision. All C librairies are included in C++. Mixing C and C++ isn't the easiest task, however OO C++ and procedural C++ can be mixed easily. I agree, but I've been having some trouble with various C++ libraries that immediatly goes away when I switch to the C versions. Might just be my compiler MSVC++ 6.0
  2. Four spaced tabs - Aye.
  3. External librairies when possible (ie. Boost) Internal libraries where possible, to decrease the number of code dependancies, except where external libraries perform the job faster/more comoprehensively than internal libraries can.
  4. SDL Dunno, haven't looked into graphics libraries yet.
  5. Fox Toolkit
  6. OpenGL

See also

  1. RoundTable
  2. C/C++ Reference
  3. C++ FAQ Lite