The Stack Overflow podcast is back! Listen to an interview with our new CEO.
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 114930

Questions about C++, a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language.

2
votes
Does the second code have some problem? Yes, two. You are making it into the equivalent of a public field and thereby fixing and revealing the implementation. It breaks encapsulation and locks …
answered Sep 1 '14 by david.pfx
0
votes
My instant response is: don't do that! When you mix declarations of classes together in the same file you introduce dependencies and coupling that will come back to bit you. But beneath that I detect …
answered Jun 8 '14 by david.pfx
4
votes
A constructor is a function that you call when the object does not yet exist, so it could not be a member function. It could be static. A constructor actually gets called with a this pointer, after t …
answered Jun 21 '14 by david.pfx
1
vote
From our experience, cursors cause more trouble than they're worth. SQL is about result sets, and that's what you should be dealing with. The ideal is to decide on some result set size that optimises …
answered Aug 10 '14 by david.pfx
4
votes
Working in a constrained memory environment (something that few of us do these days), it is entirely reasonable to use no heap allocation whatever. And C++ can work very nicely to make that possible. …
answered Jun 17 '14 by david.pfx
3
votes
The push back is not complicated. Its argument is (somewhat). If this is a common idiom and consistently used through the code, then it's good practice. I might prefer to evaluate the argument into a …
answered Feb 19 '14 by david.pfx
3
votes
I take "sets of files" in this context as meaning named files stored in a filesystem on some kind of random access storage, and I take "present to the programmer" to imply that this filesystem should …
answered Aug 20 '14 by david.pfx
0
votes
It's a valid question, but not for screening. I used it as a written question, to be discussed at interview. You can get a lot of insight into thinking patterns given advance notice. As a screening qu …
answered Mar 25 '14 by david.pfx
5
votes
This is a common problem for maintainers of old/legacy code, and there is no single perfect answer. Before making the decision to replace working code, I would propose trying to answer these three que …
answered Apr 4 '16 by david.pfx
1
vote
The Windows copy/paste function has several components. A cute GUI interface Pre-analysis of the work to be done, to help the GUI provide nice feedback and detect conflicts Essentially single taskin …
answered Jun 15 '14 by david.pfx
0
votes
There are two interesting things to note here. First, this is a common pattern for checking each of the low-order 4 bits of an integral value. The if condition is met if the corresponding bit is set. …
answered Jul 2 '14 by david.pfx
14
votes
Yes. It helps the reader to understand your intent. Clearly foo is given an initial value and never changed thereafter. It helps the compiler to optimise your code, for both speed and space. The co …
answered Feb 19 '14 by david.pfx
5
votes
As far as I am aware there is no explicit convention for passing a this pointer. Since it is passed into the function as a hidden additional argument, it will be passed using the convention for argume …
answered Jun 22 '14 by david.pfx
10
votes
From Herb Sutter using the reference quoted: The vector specialization was intentionally put into the standard to provide an example of how to write a proxied container. A "proxied container" …
answered Nov 10 '16 by david.pfx
3
votes
You have exactly 240 unique values for colour, length and size. If the id is strictly ascending as in your example, you don't need to store it and the data could conveniently be packed in a single sho …
answered Feb 11 '14 by david.pfx

15 30 50 per page