This question already has answers here:
Why was getenv standardised but not setenv?
(2 answers)
Closed last month.
The C++ standard has std::getenv, but I have to fallback to C's setenv (and be hit with deprecation warnings for including <stdlib.h>).
Is there a reason for this?
Is there a reason for this?
setenv() is operating system specific POSIX function. It's not part of the C programming language standard, so it's not imported in C++ in std:: namespace.
Related
This question already has answers here:
Changing a macro at runtime in C
(5 answers)
Closed 5 years ago.
Right now I'm merging two codes with the same core, but they differentiate with the #defines, what I need is to make a way around it an choose wicth configuration I need on run time, the code uses if ENABLE(defined) to verify the configurations to load, how can I modify the code to make it work?
Thanks
You can't. Macro are pre-processor. They are gone during compilation.
Variables are the best choice.
By the way, this question is answered here.
Changing a macro at runtime in C
This question already has answers here:
How to detect reliably Mac OS X, iOS, Linux, Windows in C preprocessor? [duplicate]
(3 answers)
Closed 8 years ago.
It's been 10 years since I've learned C++ during high school, now I'm playing around it again and I'll already facing some problems regarding multi-platform.
I saw that if I want to display special characters on windows, I should use wprintf. However, on *nix systems, it is not necessary.
So, how can I detect what is the current platform, so I can run printf or wprintf depending on it?
UPDATE
I'll open a new question with the error and close this one.
You could simply use wprintf (or wcout <<) on either platform. See this question for an example.
This question already has answers here:
C++ equivalent of java's instanceof
(5 answers)
Closed 9 years ago.
How can I check the class type in c++?
In Java I used instanceof.
I prefer not to use dynamic cast, but only classic c++.
Is there any way?
Clarification:
It isn't a duplicate of another question in StackOverflow, since I asked how can I find it without using of dynamic_cast. In the other question, the answer was to use it. Please don't mark it as a duplicated.
There is no way to check class type without RTTI or it's home brew substitution. If application compiled without RTTI information about type is not stored anywhere.
This question already has answers here:
Bignum libraries for windows?
(4 answers)
Closed 9 years ago.
Is there a library that can be implemented relatively easily in windows?
I made a few functions a while ago which used arrays of numbers to get the desired outcome. I might work at them when I get the time.
But is there any such feature already available that can be implemented into c++ easily?
Apparently people have had luck with using the GNU Multiple Precision Arithmetic Library for Windows.
This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
Modules in C++0x
why a compiler can't find a template definition in .cpp
I'm wondering if it is planned to add a Module support in C++ instead of current header system ?
I have discovered this paper : http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2316.pdf
Any news on that ?
Modules aren't in the new C++0X/C++11.
See: C++ Modules - why were they removed from C++0x? Will they be back later on?