What are the silent changes of behaviour when updating c++? [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Consider a C++98 code base that I would like to update to C++14.
I really want to do this upgrade as it would benefit the code base gratelly, the question is the burden of such update.
The problem is that this code base does not have a comprehensive test suite. Therefore after updating, some changes of behaviour that would not get caught in compile time, might go unnoticed.
Now, I know the standards comittee rarely introduces breaking changes, especially silent ones, and yet some changes are inevitable.
For risk analysis and timeline purposes of upgrading the language version I need to know the following:
Is there a comprehensive (or partial) list of such changes?
Is there an automated tool that can point to potential instances of silent breakages in my code base (to be fixed manually)?

The C++ standard itself has such a list. I believe it isn't entirely comprehensive (especially if you do things that often work in practice but aren't allowed by the standard, like extending the std namespace in unsupported ways.
If you look at Appendix C of the C++14 standard, you see that it lists differences between C++17 and older versions of C++ going back to C++03. Section C.1 is irrelevant for your purposes because it's a comparison with C, but C.2 and C.3 is probably helpful.
If you want to convert to another standard instead (C++17 is currently the most recent published version and I'd highly recommend migrating to that if you're migrating anyway), you can find links to those in browsable HTML form here. Note that none of these are the official standard, but they are very close; the only differences are minor editorial fixes in one direction or the other.
I am not aware of any automated tools to help with the migration, but I wouldn't be surprised if any existed.

Related

Is there unit tests for STL containers? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
Is there ready unit tests for testing if STL containers are working correctly, something that was used by compiler creators?
I'm making a simple port of the STL in C and need to test the data structures and thought that STL unit tests already existed, but didn't find anything
Is there unit tests for STL containers?
STL does not exist anymore. Read the C++11 standard n3337 and see this C++ reference website. Consider also using Boost.
Both recent GCC and recent Clang provide testsuites for the standard C++ containers library, whose implementation is practically tied to the compiler (because of compiler optimizations)
I'm making a simple port of the STL in C
Then look -at least for inspiration- into Glib (from GTK) and SGLIB. I tend to think that you could use one of them. Given the complexity of the standard C++ library, I believe you won't be able to make from scratch in just a few weeks a simple port of it to C if you care about efficiency. Look also into MILEPOST GCC and read this paper then Artificial Beings: the conscience of a conscious machine ISBN:9781848211018 for some interesting insights.
Otherwise, be sure to read Introduction to algorithms
Notice that with some care, you usually can write in C++ a library callable from C (use extern "C" appropriately and systematically). A good example is of course libgccjit (which you could consider using, for some partial evaluation based approaches: you might generate specialized machine code suited to particular instances of your problems).
If you code your generic container library in C, consider using Frama-C on it, and with a recent GCC, compile it with all warnings and static analysis options. You might even consider writing your GCC plugin to check that users of your library are using it correctly.
See also the European DECODER project.

google test/mock vs boost vs catch support for c++14/c++17 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
The community reviewed whether to reopen this question 29 days ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I am evaluating which testing framework would be ideal for me.
The choice is among these three: google test, boost.test and catch.
I would like something robust that has not so many dependencies and that is able to support C++14/C++17 if needed.
Another question, do you know which framework big companies in the avionics/space fields use?
I would like something robust that has not so many dependencies and that is able to support c++14/c++17 if needed.
Google C++ test framework requirements mention:
A C++98-standard-compliant compiler
It works just fine with C++14, I personally use it. From the linked documentation you can see that it has no dependencies on external libraries (see section requirements).
Catch known limitations mention:
our desire to support C++98 compilers
It works just fine with C++14, I personally used it in a couple of projects at work. Catch is a header only library, it has no dependencies at all.
Boost C++ libraries usually perform compile-time detection of compiler support for the standards and features are enabled/disabled depending on the result.
As a rule of thumb, those libraries usually depend on some other libraries picked up from Boost itself.
do you know which framework big companies in the avionics/space fields use?
Often they require not only to write tests but also to have a code coverage estimation. There are a plenty of professional tools for that, few of them are for free and (at least, as long as I know) there doesn't exist a standard de facto for that.

Options for hot deployment [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
My requirement is to seamlessly hot deploy code update to a running service without losing the current status, including collection data. Is there any c++ framework out there I can use to develop such a solution?
You probably should read some research papers on dynamic software updating, e.g. on Kitsune (which you might use)
There is a major issue about updating the call stack (and instances in local variables); read also about continuations; and you might have some special case (if your application is event loop driven like most GUI applications are, you probably want to update the code outside of event handlers).
You certainly should think of dynamic software update very early in your design. Perhaps some terminology and concepts from garbage collection & persistence & serialization techniques are relevant.
Your requirement (to seamlessly hot deploy code update to a running service without losing the current status) is very hard and will need a lot of work (probably years) and is still a difficult & interesting research topic (definitely it is a good PhD subject).
You might want to use your own meta-programming techniques, that is generate most of the relevant C+++ support code by your own code generators.
If you already have a significant code base, you could consider customizing a recent GCC compiler with MELT (e.g. to query the compiler's internal representations and generate some code from them) -but even that means a lot of work-
PS. Coding in something better than C++, like Erlang or Common Lisp, would make your goal less difficult.

Translating new C++ to old C++ [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
C++11 and C++14 introduce a lot of new features that make programmers' lives easier. However, in various environments (e.g. CUDA), support for the most modern C++ features may be weak or nonexistent.
Many of these features (e.g. auto, decltype, constexpr, variadic templates) do not add any challenges to code generation, and really only require a parser that understands the constructs. In principle, unless honestly new functionality (e.g. thread_local) is used, there could be a tool that takes C++14 code and converts it into something that could be built with something that only understands the C++03 language.
Does such a tool exist? (or are my presumptions way off base?)
AFAIK no such tool exist. Some C++ compilers (the original Cfront, and perhaps Comeau C++) generated C code.
You might customize GCC (e.g. using MELT) to translate the internal Gimple representation to a small subset of C++. This is a lot of work (and the emitted C++ won't be portable).
Maybe you should consider OpenACC

Any good advice on using emacs for C++ project? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I'm looking for a good article on using emacs as C/C++ IDE.
Something like Steve Yegge's "Effective emacs".
No specific article, really, but I've found EmacsWiki to be full of useful information. Consider checking out these entries:
CPlusPlus as a starting point for many C++-related articles, and
CppTemplate to define a template that can give you a good skeleton when you start new files
I've recently stumbled upon this article which is quite good.
EDIT: Yep the link is no longer valid. It seems like they've changed their url recently and it doesn't redirect properly. Hopefully it will be back soon. Anyway the article was called "Benjamin Rutt's Emacs C development tips". I managed to find a copy here.
I'm planning to write such article in near future, but you can now take my configuration of Cedet + Emacs, that helps me to effectively edit C++ sources.
If you'll have questions, you could ask me directly
Be aware that Emacs' C++ mode is based on only regular expressions, not a grammar. Hence, the syntax highlighting is not based strictly on the syntax of the language itself, but rather is largely based on commonplace formatting. The Emacs syntax highlighting of C++ often makes mistakes.
The problem is not limited to syntax hightlighting. The same defective design applies to the automatic formatting. All this said, I have been using only Emacs for all of my editing of C++ source code for over 20 years, since the cfront days. (I usually turn off electric key bindings, because of Emacs' defective regex-based design. Regexes do not have enough expressive power to describe the C++ syntax accurately.
I recommend ggtags and irony-mode. Other then that you may want to use helm-ag to search ("grep") for strings in your codebase.