« first day (467 days earlier)      last day (2610 days later) » 

Ron
Ron
00:13
I seem to be unable to find the relevant info in the standard for this one. I suspect it is somewhere in the 8.5.1. Not sure where to look for.
I know that definition of aggregates in C++11 excludes the use on classes with member initializers whereas that restriction was lifted in C++14. I am unable to quote the right reference though.
 
1 hour later…
01:38
Hello, I haven been trying to implement MFC project and I would like to know when the window is moved. I use onMove() for this, However, my onMove() method is called immediately instead of being called when I drag the window.
Does anybody have an idea for this?
 
3 hours later…
04:21
I notice some template based libraries ask to use at least -O2 optimization, is there a reason for this? (example: Boost Graph library)
 
1 hour later…
05:41
if(cout<<"1"){...} will print 1 or not?
06:00
also if statement will be executed or not?
 
2 hours later…
08:30
Why does execution of c++ program require main function while compilation doesn't need it?
Also main is not a reserved keyword, So can we change main function name?
please,Can anyone help me?
@wilx I think this is not that much big question to ask there...

C++ Questions and Answers

Solve problems and approach solutions. Just ask and lurkers wi...
@wilx thanks :P)
08:46
@VineetJain yes, yes
@milleniumbug cout should be ending with a semicolon? Am I wrong?
@AnnaK. There is a lot of abstraction and some inlining is necessary to generate decent code.
@AnnaK. Last time I tried to use Boost.Graph, my program on debug mode took way longer than on release mode (think 10x longer)
Of course this raised a question how am I supposed to debug my application, which remains to this day
Maybe -Og would be sufficient for gcc
@VineetJain a non-block statement should. the expression inside parentheses is not a statement
 
1 hour later…
10:04
if you look at the output carefully you will see that the second dot is not the only thing missing.
http://en.cppreference.com/w/cpp/string/basic_string/substr
Think about what find returns and how that relates to size and of what.
10:54
and this room is still empty...
11:07
8 messages moved from Lounge<C++>
Aug 30 '16 at 7:36, by milleniumbug
You don't ask a question because room is empty? Well, it's empty because you haven't asked the question!
also ffs I answered every question you posted here so far
2
11:55
@VineetJain CRICKETS
Weird definition of empty
@yode it's not the same environment
 
1 hour later…
13:08
how do I pass cin as a function? I want another function which accepts a function to read numbers directly from cin (the function which is to be called calls my function get numbers)
@Yashas cin is not a function, so you can not pass it "as a function". You can obviously pass it to a function if the function accepts a reference to the type of std::cin, so e.g.:
void foo(std::istream& is) {
    int i;
    if (is >> i)
         std::cout << "The stream contained " << i << "\n";
}
and also you can pass a lambda that does std::cin >> i
 
1 hour later…
14:34
hi, I'm reading a c++ book which  contains this code:

    Pizza* p = data.retrieve(key);
    if(p != NULL)
       // do stuff

This is causing a type missmatch error in visual studio 2017. What happens? And why does this not work?

The statement above is much cleaner than writing:

Pizza *p = data.retrieve(key);

if((int*)&p == NULL) { // works

}
Of course the last if condition should should contain (Pizza*)&p == Null
fixed it, I already had defined a variable called p in the same scope with the type Pizza (no pointer) above this caused that behaviour.
14:56
@milleniumbug Well since Boost Graph is so arcane, I tried using lemon but I can't find an option for visualizing the nodes without me entering by hand the coords (coordinates)
@Yashas coliru.stacked-crooked.com/a/48878a0abcfbd62d - i.e. you can put anything you want your "function" to do into lambda and pass it instead. You can also use std::bind on operator>>.
15:50
Or you can return numbers instead: coliru.stacked-crooked.com/a/f43285dbd9244a53 - this cannot be directly achieved with std::bind.
16:02
@MatthiasHerrmann Trying to cast your way out of compiler errors is a bad habit, drop it
16:21
In fact, don't use the C-style cast at all
@MatthiasHerrmann NULL expands to 0 which is convertible to a null pointer of any type--but this use is discouraged since nullptr was introduced. Simply replace NULL with nullptr (and don't include any cast at all) and it should work better.
Note that if p is a pointer, comparing if (&p ...) probably isn't what you wanted.
16:41
@milleniumbug @JerryCoffin Ty for the tips, I will use the C++ cast operators instead and use nullptr instead of NULL
remember that the code quality is inversely proportional to the number of casts in it
I try to read up on coding conventions and clean code in C++. Taking those aspects in consideration while learning the basics of this language is hard though, but I try my best
17:37
@MatthiasHerrmann There are a few cases where casts are hard to avoid (e.g., the first argument to ostream::write often needs one). This isn't one of those cases-there's no need to use any cast here, so you shouldn't.
17:57
@JerryCoffin Yep, the cast is not necessary in this case, I only needed to check if the pointer is a nullpointer.
I replaced the code by if(p) which is true if the pointer is not a nullpointer
hi guys
18:44
@milleniumbug I'll damned well say hi if I want, thank you very much. Unnecessary, to be sure, but also harmless.

« first day (467 days earlier)      last day (2610 days later) »