« first day (1421 days earlier)      last day (1437 days later) » 

11:11 AM
hey guys, is there any rule of thumb as to when parameters should be passed by pointer or by reference?
same goes for the return type of functions
 
 
1 hour later…
12:12 PM
if T is a non-POD (until C++11) class type, the constructors are considered and subjected to overload resolution against the empty argument list. The constructor selected (which is one of the default constructors) is called to provide the initial value for the new object;
this is from cppreference.com
the last statement seems to imply that there can be more than one default constructor for a class type? which is not the case. Or am I not reading it well?
 
12:43 PM
system("clear") for C doesn't work in eclipse, what should I do? it prints a special character instead.
 
@Archer why would it? clear is a terminal command not a terminal output code
 
@Mgetz Then why does it work in CodeBlocks IDE?
 
@Archer no idea! but either way clear is another program not a console output command
The proper way on newer windows and linux is to use VTT commands
or whatever they're called since it's early and apparently that's not it
 
I am making a simple user application and need to switch between different user screens. How do I do this?
I thought I would clear the screen and print the next set of instructions
 
that doesn't sound simple
 
12:48 PM
@Mgetz So there's no way to clear the output screen using C code?
 
@Archer oh there is... it's just not a one liner last I checked.
 
> Using system("clear") - For gcc/g++ compiler in Linux
 
that... is a horrible resource
 
6
A: How do I clear the screen in C?

Commander WorfThe best way to clear the screen is to call the shell via system(const char *command) in stdlib.h: system("clear"); //*nix or system("cls"); //windows Then again, it's always a good idea to minimize your reliance on functions that call the system/environment, as they can cause all kinds of ...

 
@Archer Note the higher voted answer beneath it
10
A: How do I clear the screen in C?

JiminionYou need to check out curses.h. It is a terminal (cursor) handling library, which makes all supported text screens behave in a similar manner. There are three released versions, the third (ncurses) is the one you want, as it is the newest, and is ported to the most platforms. The official webs...

 
12:51 PM
Alright, but I am not allowed to use external libraries :(
Guess I'll just stick to printing regularly then ..
 
 
3 hours later…
3:24 PM
Guys is it even remotely possible to implement this^ in C without external libraries?
 
4:21 PM
With a and b as vector<int>s,
if (a.begin() > b.begin()) {
c.push_back(b.begin());
b.erase(b.begin());
}
This doesn't run, and I know now it's because begin doesn't return the first element, and push_back can't take what it returns as an argument
How do I add the first element from b onto c and then delete it from b?
 
3 messages moved from Lounge<C++>
 
5:22 PM
@JohnnyApplesauce you should be able to std::move it for the most part... but for int that shouldn't be necessary
 
 
2 hours later…
7:16 PM
I'm trying to convert this C code to Java, where 'it' is an int, could someone help?

/* convert bits to float */
return *(const float*)( &it );
Would this: Float.intBitsToFloat(it)
...preserve what the c code is doing?
 
@micycle so I can't really help other than to say... don't... just don't. Figure out the higher level intent and the follow Java idiom. Or worst case use JNI and use the C code.
 
7:40 PM
@Mgetz In the end, Float.intBitsToFloat(it) worked. What's with the "don't... just don't? haha
 
He means it's more trouble than it's worth
 

« first day (1421 days earlier)      last day (1437 days later) »