|
[Sponsors] |
May 31, 2015, 14:51 |
A few code questions
|
#1 |
Senior Member
|
During ongoing attempt to build OpenFOAM with "-Wall -Wextra -std=c++11" flags without any warnings the following questions arose. Since they are not bugs and not a feature proposal yet, I have decided to discuss it here.
1. C++11 standard deprecates register variable modifier. Yet it quite frequently used in base library. Should it be kept in the code? 2. There are plenty of unused parameters in the code, which way of suppressing warning is preferred? There are several common methods: use UNUSED macro (which is basically UNUSED(x) (void)x), comment-out name of the parameter, just remove parameter name. 3. Though both g++ and clang produce code that can deal with NULL-pointer dereferencing into constant reference (directAddressing in FieldMapper.H is an example), stiil this behavior is undefined in standard. Should these parts kept as they are or should pointer-returning methods added to those cases? 4. In most cases implementation of child classes is OK, but from time to time developers desire strange things (functionObjects library is an example) like return type overload. I.e. functionObject class is a child of regIOobject, yet it is not happy with write method that returns bool, it would like to have write method returning nothing (i.e. void). Should such cases be prohibited (i.e. enforce correct method overload) or left as they are (allow method hiding)? 5. This question is just about author intentions in readKivaGrid.H file. There is a loop on line 426 Code:
for ( ; iterf != pFaces[WEDGE][0].end(), iterb != pFaces[WEDGE][1].end(); ++iterf, ++iterb ) { ... } Code:
for ( ; iterf != pFaces[WEDGE][0].end() && iterb != pFaces[WEDGE][1].end(); ++iterf, ++iterb ) { ... } 6. This question is about author intention in surfaceBooleanFeatures.C. On line 357 there is calcFeaturePoints function. At the end of this function the following variables are defined: Code:
label concaveStart = 0; label mixedStart = 0; label nonFeatureStart = nFeaturePoints; labelListList featurePointNormals(nFeaturePoints); labelListList featurePointEdges(nFeaturePoints); labelList regionEdges; |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
some questions on using unsteady code | pangpang | Phoenics | 0 | January 25, 2002 22:22 |
Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 15:56 |
What is the Better Way to Do CFD? | John C. Chien | Main CFD Forum | 54 | April 23, 2001 08:10 |
own Code vs. commercial code | Bernhard Mueck | Main CFD Forum | 10 | February 16, 2000 10:07 |
public CFD Code development | Heinz Wilkening | Main CFD Forum | 38 | March 5, 1999 11:44 |