Difference between revisions of "C plus plus version"
From WikiManual
m |
|||
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>. | ||
− | + | We discuss the C++ design and coding standards in here. A wiki is much handier then a forum or PM's for this. | |
== Language switch == | == Language switch == | ||
Line 13: | Line 13: | ||
=== General concepts === | === General concepts === | ||
− | * Class based approach. <font color="Red"> In some cases, procedural in others. | + | * Class based approach. <font color="Red"> In some cases, procedural in others. It's a value decision I'll make as I port the code. </font> |
* Portable code. <font color="Red"> Where possible. Preferably in house or free library wrappers for non portable functions, such as multithreading and OS timers. </font> | * Portable code. <font color="Red"> Where possible. Preferably in house or free library wrappers for non portable functions, such as multithreading and OS timers. </font> | ||
=== Structure === | === Structure === | ||
− | <font color="Red"> See the present VB code </font> | + | <font color="Red"> See the present VB code </font> The VB stucture is not a good C++ structure. VB and C++ are totally diffrent languages. |
− | + | * User Interface ([http://www.fox-toolkit.org Fox Toolkit]) | |
− | + | ** Simulation sub window (3D - [http://www.opengl.org OpenGL]) | |
− | |||
** Darwin (the simulation engine) | ** Darwin (the simulation engine) | ||
− | |||
*** Tie | *** Tie | ||
− | *** Robot | + | **** Robot |
− | **** Sense | + | ***** Sense |
+ | **** Veg | ||
To be used everywhere: | To be used everywhere: | ||
− | * Vector_4 (using [http://www.boost.org/libs/numeric/ublas/doc uBLAS]) <font color="Red"> Present vector class is from [http://www.gamedev.net/reference/articles/article605.asp this article]. | + | * Vector_4 (using [http://www.boost.org/libs/numeric/ublas/doc uBLAS]) <font color="Red"> Present vector class is from [http://www.gamedev.net/reference/articles/article605.asp this gamedev.net article]. I'll use whichever is fastest, feel free to perfrom benchamrks </font> |
* Matrix_4 (also using uBLAS) <font color="Red"> See above </font> | * Matrix_4 (also using uBLAS) <font color="Red"> See above </font> | ||
* Random (using 'srand()' and 'rand()') <font color="Red"> See [http://library.lanl.gov/numerical/ the chapter on random numbers]</font> | * Random (using 'srand()' and 'rand()') <font color="Red"> See [http://library.lanl.gov/numerical/ the chapter on random numbers]</font> | ||
Line 36: | Line 35: | ||
== C++ coding standards == | == C++ coding standards == | ||
− | # 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> Prolly, it's crap. :-P | + | # 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> Prolly, it's crap. :-P Try the MinGW version of the gcc compiler. |
# 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> |
# Use the 80 character line <font color="Red">If you insist...</font> Yup, I do. ;-) | # Use the 80 character line <font color="Red">If you insist...</font> Yup, I do. ;-) | ||
# [http://www.fox-toolkit.org Fox Toolkit] | # [http://www.fox-toolkit.org Fox Toolkit] | ||
# [http://www.opengl.org OpenGL] | # [http://www.opengl.org OpenGL] | ||
+ | |||
+ | == Quotes == | ||
+ | |||
+ | # "There must be something terribly wrong with your code. Please fix it." -- [http://www.bloodshed.net/dev/devcpp.html Dev-C++] | ||
== See also == | == See also == |
Revision as of 06:23, 1 November 2005
Original document (and comments) by Taldor in black, comments by Numsgil in Red.
We discuss the C++ design and coding standards in here. A wiki is much handier then a forum or PM's for this.
Contents
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.
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 The VB stucture is not a good C++ structure. VB and C++ are totally diffrent languages.
- User Interface (Fox Toolkit)
- Simulation sub window (3D - OpenGL)
- Darwin (the simulation engine)
- Tie
- Robot
- Sense
- Veg
- Robot
- Tie
To be used everywhere:
- Vector_4 (using uBLAS) Present vector class is from this gamedev.net 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
- 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 Prolly, it's crap. :-P Try the MinGW version of the gcc compiler.
- Four spaced tabs - Aye.
- 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.
- Use the 80 character line If you insist... Yup, I do. ;-)
- Fox Toolkit
- OpenGL
Quotes
- "There must be something terribly wrong with your code. Please fix it." -- Dev-C++