Comments (12)
That's an interesting option. I am not familiar with all the goodies brought by the last revisions of the C++ standard but there are a couple of interesting features in C++11:
constexpr
- The type inference
auto
- The range based
for
loops
from jsbsim.
@bcoconni I like those new features as well as the std::unique_ptr
and lambda functions. See for example here, here, here, or here.
My proposal: From now on switch to C++11, whether we are reviewing old code or we are adding new features to the library.
from jsbsim.
Since we are embedding the code of JSBSim in FlightGear and since they are using C++11, I suggest we do not use features of C++ earlier than C++11.
from jsbsim.
@bcoconni I presume you meant to write not later than C++11 (from 2011), i.e. don't use any features in C++14 or C++17?
from jsbsim.
@seanmcleod
Ooops ! Yes you are right, I meant later
from jsbsim.
I propose this additional configuration in src/CMakeLists.txt
if(NOT CMAKE_VERSION VERSION_LESS 3.1)
set(CMAKE_CXX_STANDARD 11)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
from jsbsim.
@agodemar Is the flag -std=c++11
recognized by all compilers (Visual C++, gcc and clang) ?
from jsbsim.
- Visual C++: The compiler does not offer a specific C++11 mode and defaults to C++14, but that standard is fully inclusive of C++11.
- g++: yes
- clang: yes
from jsbsim.
Thanks.
So I guess Visual C++ will complain if we provide it with the flag -std=c++11
? Which means that the code should be something like below (swapping the two if
branches to save the negation NOT
on the CMake version condition) ?
if (CMAKE_VERSION VERSION_LESS 3.1)
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
else()
set(CMAKE_CXX_STANDARD 11)
endif()
from jsbsim.
It should work.
There is no C++11 flag for Visual C++. For later versions of the standard the flags are: /std:c++14
and /std:c++17
(or /std:c++latest
).
from jsbsim.
@agodemar
Will you push that change to master
? I suggest that you skip the pull request process and push directly to JSBSim:master
from jsbsim.
I've changed the title of this issue, which is now closed.
from jsbsim.
Related Issues (20)
- Compilation Failed While Opening in UE 5.1 HOT 9
- JSBSim crashes after a while at FGTable::GetValue() HOT 20
- FGStandardAtmosphere:CalculatePressureAltitude() can cause NaN values HOT 19
- FDM returns NaN values in properties (not for a crash) HOT 17
- Visual Studio Build issue
- JSBSim for SPEC CPUv8 HOT 52
- aero/coefficient properties returning 0 HOT 1
- Android support HOT 4
- Can't build Unreal Engine plugin on Linux/Mac because of unsupported typeid keyword HOT 5
- JSBSim Unreal throws an Exception few seconds after/during takeoff HOT 1
- Missing support for castering nosewheel with angle limiter. HOT 8
- Param name new name in the form "hostname:port/proto" is not right in FGOutputSocket::SetOutputName HOT 4
- Build JSBSim by VS2019 and use C++ API HOT 1
- Crashes after adding an xml path to a component in the engine HOT 10
- Trim Errors Happening In RHEL8 On Models That Worked On RHEL7 HOT 11
- Updates to gitignore to tidy up git status after build HOT 2
- CMAKE Configure Error on MacOS (M1 aarch64) HOT 2
- After changing pitch and long initial conditions the yaw angle changes also for no reason HOT 1
- JSBSim interface to Matlab on Windows: throttle command from joystick doesn't work HOT 5
- Trim succeeds and results in NaN values HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsbsim.