« first day (251 days earlier)      last day (4696 days later) » 

12:00 AM
With an accompanying rollback war to add/remove that disclaimer.
Trigger-happy close voters are annoying.
Especially those that think if the answer to a question is "no", the question is "not a real question".
 
yes, I know what you were talking about
 
speaking of trigger-happy close voters, if stackoverflow.com/questions/6461784/… gets closed I will certainly vote to re-open
 
Xeo
@TomalakGeretkal After rereading it, me too
hm. SO gives me white pages
 
me too
what's going on?
 
12:05 AM
the fuck, SO gone offline
 
Xeo
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!
 
@Xeo Why did you reply to me with nothing but a TVTropes link? That should be illegal!
 
shit, it's the whole fucking network
 
lulz, maybe hacked? :P
 
12:06 AM
Except for chat.
 
I had one comment to post before bed.
 
@MartinhoFernandes lulz
 
@MartinhoFernandes yea
 
Xeo
@MartinhoFernandes I wish they'd inline tvtropes links :)
@Nils "lulz" .. good one
 
TVTrope links are dangerous
 
Xeo
12:07 AM
Ahh, pff, just because they singlehandedly destroy thousands of work-hours if posted in an answer on SO?
> Stack Overflow is currently offline for maintenance
Took em long enough
 
@Xeo what do you mean?
 
Luckily I managed to come to myself at WARNING: TVTropes link ahead Tastes Like Diabetes.
 
lol, the inherent dangers of the interwebs... getting addicted :P
 
And Chrome's "Close tabs to the right" is a great feature.
 
humm maybe I should go to bed
 
12:09 AM
planned maintenance my ass
oh well, guess I'll have to post that comment in the morning
BYE
 
I believe it.
It's not the first time I've hit that offline page between 0:00 UTC - 1:00 UTC.
 
@TonyTheTiger What do you mean by "getting addicted"? Is TVTropes starting to have an effect on you (i.e. are you becoming normal?)
we think peer1 is having some kind of issue. It's affecting stack exchange and some Fog Creek services
I was wrong :(
It's back up again!
 
@MartinhoFernandes tropes isn't having the addictive effect on me that it has on some other people, however other places have that effect on me, like reddit
and SO chat
 
Ok, that's acceptable :)
Reddit doesn't work on me because I can't stand the layout.
And, Stack Exchange is back. It wasn't Peer1's fault, either, we were switching switches.
Yeah, sure.
 
12:19 AM
hmm switching switches
 
1
Q: Is this the best way to utilise tail call recursion traversing a linked list?

AlasdairBasically I am creating a base class that will be used for classes stored as a linked list, which are traversed and deleted as dictated by a virtual update() function which returns a bool. I am wondering if this is the most efficient case (I like the fact that it can be a singley linked list in ...

@Xeo that's cool :)
 
@Xeo isup.me is a shortcut.
Oh, it says so on the page.
 
Xeo
I just had to do it:
0
Q: Oneboxing TVTropes links in SO chat

XeoSince TVTropes is just another wiki, though very popular, I'd propose it for inclusion on the list of things that get oneboxed in the SO chat similar to how Wikipedia is oneboxed. Time to take cover?

 
That's just stupid.
 
Xeo
12:26 AM
Well, why? It's just another wiki.
 
Guess who was the first to downvote.
 
Xeo
:P
 
 
3 hours later…
3:30 AM
0
Q: Why does stringizing an euro sign within a string literal using UTF8 not produce an UCN?

Johannes Schaub - litbThe spec says that at phase 1 of compilation Any source file character not in the basic source character set (2.3) is replaced by the universal-character-name that designates that character. and at phase 4 it says Preprocessing directives are executed, macro invocations are expanded a...

 
 
5 hours later…
8:40 AM
argh? I can no longer link to comments at all?
 
Morning
 
8:55 AM
just seen "Please avoid extended discussions in comments. Would you like to automatically move this discussion to chat?" for the first time, hehe
strangely comments aren't being rendered with links for me on one PC, and they are on another
 
Comments were never rendered with links, AFAIK.
Unless you don't mean links to the comments themselves.
 
gasp chat is just comments on steroids!
3
 
I'm still waking up.
 
@MartinhoFernandes Yes, they are. The dates are clickable.
Maybe this is a recent change that SE Modifications has hidden from me
mmmm... yes, there we go. SE Modifications made the dates clickable. So there really isn't explicit support for links to comments. You have to hack the ID out of the source. How lame!
 
(That's what I just did up there.)
 
9:03 AM
If you look quickly before somebody does another vote, my rep score is currently 88888, for whatever that might be worth... :-)
 
Bah, gloating about your rep ;)
 
@MartinhoFernandes Only when I hit a palindrome, or something at least equally interesting. I once did a couple of spurious downvotes (that I quickly removed) just so I could momentarily hit a perfect number...
 
I'm guilty of doing the same, but usually for primes :)
 
I am looking for some intresting blogs about C and C++ do you have any favorites?
 
There I upboated one of your old answers and broke your palindrome!
:P
Now, back to debugging.
 
@MartinhoFernandes Hmmm...10 downvotes of your answers, and I'll have it back though! :-)
 
@JerryCoffin too late; hope you screenshotted it :P
 
Ouch.
The suspicious voting scripts would probably detect that.
 
@MartinhoFernandes Probably -- but it'd probably still reduce my rep at least momentarily...
@TomalakGeretkal Nah -- not sure what I'd do with a screenshot of it anyway. It was cool for the couple of minutes while it lasted though.
 
9:16 AM
Be positive! You can get to another palindrome by gaining upvotes.
88988 is up next.
 
@MartinhoFernandes Yup -- somehow they usually happen when I'm not looking though.
 
Xeo
@MartinhoFernandes One downvote and that will be not so easy. :)
Hah, the old discussion - arrays and pointers
and arrays of pointers to arrays.
Is that one even possible?
 
Sure
I just demonstrated it
 
Of course it is.
 
9:19 AM
Well OK I didn't
But it is :)
 
Xeo
Right, I mixed that up
Funnily enough, I never had problems with pointer to pointer and stuff, because it somehow was the first thing I learned about programming
 
int (*a[3])[3] ?
 
@LucDanton yea, think so
 
Xeo
says yes
> declare a as array 3 of pointer to array 3 of int
 
Love that.
 
9:21 AM
@Xeo tools like that don't always guarantee that the syntax is actually valid; they merely apply the basic lexical interpretation
 
"C gibberish <-> English" made me laugh real hard.
Well, would a compiler make you happy? ideone.com/ioqAT
 
for example, write char&* f() in the box.
 
Xeo
But seriously, C++ needs to provide an alternative way for variable declarations...
 
I know that it isn't a sure way because compilers don't always implement the standard correctly, but...
 
@MartinhoFernandes no, the tool doesn't implement the standard correctly.
 
9:23 AM
@MartinhoFernandes But at least they make a serious attempt, which cdecl mostly doesn't.
 
@TomalakGeretkal Do you have an example?
 
@TomalakGeretkal That's not a valid C declaration because C doesn't have references. And cdecl knows that.
 
@MartinhoFernandes the website is not an actual C++ compiler/parser. it's just parsing the declarator lexically. it has no semantics. Interestingly, it seems to have made an exception for the obvious case of T*&, but in general it's not a tool that tells you what types are valid in C++ [I know it's a C site, but it appears to support C++ with warnings]; it just tells you what the type you're attempting to use says in English.
@MartinhoFernandes Put char& f in. It's accepted, with a visual warning that that would be C++.
 
@Xeo I'm not sure it's a good idea to make more complex declarations more readable. If you have an excessively complex declaration, it's better to simplify it, not change the syntax. typedef is your friend...
 
@LucDanton I already provided one.
@LucDanton It's also trivially obvious that that is what such tools do.
 
9:25 AM
@TomalakGeretkal A warning counts as a diagnostic doesn't it?
 
@LucDanton That is not a C compiler.
 
@LucDanton If and only if the documentation says it does.
 
@TomalakGeretkal I'm not arguing that. I'm arguing you're example are ill-chosen
 
@LucDanton On what grounds?
 
You're feeding C++ to a tool called cdecl that warns you you're not using C.
 
9:27 AM
@LucDanton I don't see the relevance. The tool clearly supports C++, with the caveat of a warning.
 
It's Friday. It's 9:30 and I'm still the only person here. Perhaps there is something I don't know.
 
Perhaps, in order to take away the confusion here, I'll pick an invalid type which only uses C features.
 
@TomalakGeretkal That's exactly my point -- the C++ stuff is irrelevant
 
@LucDanton It is relevant, because the tool supports it. But let's forget that.
@LucDanton Write char f[2][].
@LucDanton Lexically, its meaning is sound, and the lexical tool cdecl will tell you what that meaning is. Of course the declarator on its own is not actually valid anywhere, so good luck with that.
 
And btw, when I mentioned a compiler, I was talking about ideone, which is why I posted a link to a compilable example of the declarator Luc posted.
 
9:30 AM
@MartinhoFernandes ideone is a website, not a compiler.
 
GCC 4.3 is
 
@MartinhoFernandes and I don't see the relevance?
@MartinhoFernandes GCC 4.3 is a collection of build tools, including a version of ccplus1 :P
 
build tools?
 
You replied to me saying explaining cdecl wasn't a compiler. I knew that.
 
Please don't misunderstand me. I never said Luc's syntax is wrong. In fact, I was the first person to respond, and I responded with "yea, think so". I'm merely warning against trying to use tools like cdecl.org to prove it.
@LucDanton "GNU Compiler Collection"
@LucDanton What else would it be?
 
9:32 AM
I call make a build tool. I don't call compilers build tools. I don't think I'm alone in this.
 
@LucDanton OK, possibly.
@LucDanton Compilers and build tools, then :)
 
If you're going to use a compiler as a reference on what's allowed in C++, you might be better off with Comeau's. comeaucomputing.com/tryitout
 
Could you give an example of a build tool in GCC?
 
@LucDanton gcc and g++ both are, in reality. Each invokes a number of other tools in order, but neither is really a compiler in itself.
 
I can point to a driver, a preprocessor, an assembler, various front-ends, a linker and I'm not sure where to put a cross-compiler in this. I'm okay with calling the whole or parts of it a compiler toolchain or a compiler ecosystem, too.
But I don't see how or where build tools come into this.
What do you call make?
 
Xeo
9:43 AM
0
Q: Operator Overloading in C++

AbhineetI have doubt whether we can do the following or not. Suppose I have created two instance of class A i.e. obj1 and obj2 and class A has member function as show() can i use (obj1+obj2).show(); If yes how? If no why it is not possible? Thanks & regards, Abhineet Agarwal

No research effort at all?
 
@LucDanton a build tool
 
Xeo
I'm always unsure what to do with such question... what to exactly close it off as.
 
@LucDanton w.r.t. build tools I may be over-estimating how many build tools ship with GCC, c.f. how many ship with MinGW
 
@Xeo It's a valid question IMO.
Although he doesn't specify the desired outcome.
 
Xeo
And surely a duplicate, not a real question maybe too.
 
9:45 AM
The desired outcome is compilation, linkage and execution.
I don't think it's so bad.
He's asking whether you can invoke a member function on the result of a previous operation (possibly not realising that op+ there is a function call).
 
Xeo
I should've never been given the ability to cast closing votes.. I'm wasting way too much time thinking about that stuff.
 
Are temporaries const?
 
@MartinhoFernandes rvalues are const, in C++11 there's rvalue references which aren't const
Assuming that with 'temporary' you mean unamed value like std::string()
 
Yep.
GCC does not conform with that then :(
 
@MartinhoFernandes how so?
 
@MartinhoFernandes There's no way to tell what warning level is used here
 
Oh, it can get by with a warning?
 
@MartinhoFernandes that's a named value.
 
@StackedCrooked (a+b)?
 
really?
 
9:50 AM
@MartinhoFernandes It depends on the settings (e.g. warnings can always be upgraded to errors)
 
so std::string().insert('a') is not valid?
[or whatever the member is called]
 
there's also the shrink to fit idiom: std::vector<T>().swap(a_named_vector);
 
@TomalakGeretkal Yes, that's not valid.
 
$ g++ -Wall -pedantic thingy.cpp shows no output.
Should I use more flags?
 
It's weird; somewhere in my head something is screaming that one can only call const qualified members here, but I still remember this particular idiom.
 
9:52 AM
@StackedCrooked fuck me
@LucDanton great example
 
@TomalakGeretkal I'm hetero.
 
@MartinhoFernandes That's enough to trip all the warnings GCC can handle
 
@StackedCrooked standard reference please
 
@MartinhoFernandes You may want to ask on SO, I'm interested to know as well.
 
@LucDanton -Wextra recommended
 
9:52 AM
Ok, let me do that.
 
GAH
Yes
 
I'm going to ask about this
 
@TomalakGeretkal I don't have a copy of the standard.
 
@TomalakGeretkal No output.
 
0 down vote favorite


I now experimented with windows registry, but i deleted a "Create new folder..." from context menu. And now, i have a little problem . In which registry hive this point stored? I want to restore "Create new folder..."
 
@TomalakGeretkal :)
 
Try a full sentence.
 
@TomalakGeretkal rvalues are const
@TomalakGeretkal also: push_back returns void.
 
Hi!
 
9:58 AM
Hi
 
So now I don't know anything anymore XD
 
@TomalakGeretkal str() is const.
 
@TomalakGeretkal Interesting. The str() is indeed const, but I don't understand why std::stringstream() << 3 compiles.
 
Precisely.
@MartinhoFernandes relevance?
@MartinhoFernandes is the op<< const too?
 
Oh that.
I'm still waking up.
 
10:00 AM
0
Q: If temporaries are implicitly `const`, how does this work?

Tomalak Geret'kalI'm told that, in C++03, temporaries are implicitly non-modifiable. However, the following compiles for me on GCC 4.3.4 (in C++03 mode): cout << static_cast<stringstream&>(stringstream() << 3).str(); How is this compiling? (I am not talking about the rules regarding tem...

 
So temporaries are const? Or is it only references to temporaries that needs to be const?
Cool I thought about doing that.
 
@Klaim You certainly can't bind temporaries to ref-to-non-const. But that may be an unrelated thing. It's clear that a mutable reference to a temporary is silly, since you'll get an immediate dangling reference.
 
Yes that's why i thought I might have mixed up.
 
I was completely unaware that rvalues themselves are implicitly non-mutable. And there seems to be some oddness here.
 
I believed this but now I'm not so sure. We need to see the answers to your question.
 
10:02 AM
I clearly remember Bjarne mentioning in TC++PL that it's a good idea to return const stuff to avoid precisely this kind of code.
 
aha
3.10/10: "An lvalue for an object is necessary in order to modify the object except that an rvalue of class type can also be used to modify its referent under certain circumstances. [Example: a member function called for an object (9.3) can modify the object. ]"
 
"It's clear that a mutable reference to a temporary is silly, since you'll get an immediate dangling reference." - that's one of those cyclic things... if the Standard required their lifetime be extended as per consts, then it wouldn't be silly :-)
 
That would imply that std::string().insert('a') would be valid, no?
@Tony True :)
aha, std::string().insert('a') is valid, but my previous example was flawed because (as was pointed out by someone) it evaluates to void
so, then, what the fuck?
 
Wrong prototype no?
 
oh, string has no overload for insert like that
 
10:06 AM
Try insert(0, 'a')
 
I hate to ask, but how can I install glut on windows?
 
Nothing does btw. I believe it's always insert(position, item)
 
I couldn't find any up to date howto for win 7
 
It's just like any other Windows.
 
10:07 AM
Ok, see you later, I need to get back to work :)
 
Copy and paste the stuff into appropriate folders.
 
chuckles
 
Now that I think about it, that old advice to return const T for overloaded operators only makes sense if returning T allows calling non-const members
 
if you use a binary distro
 
10:10 AM
@StackedCrooked No, rvalues aren't implicitly const. There are const rvalues (like the call of a function that returns a const std::string) and non-const rvalues (like the call of a function that returns a std::string).
 
@Luc: precisely
 
@MartinhoFernandes Just copy to Windows\system32 ?
humm
 
@Tony Wait, I did read your comments some time earlier. That means I'm that slow today :(
 
@Nils NOOO!
 
heh
what about telling vs to statically link it?
 
10:12 AM
Copy the .dll file to somewhere on your PATH.
Copy the .lib to somewhere VS will look for libraries.
 
Fred your answer is not completely accurate, as my answer shows
 
Copy the .h to somewhere VS will look for includes.
 
@Klaim :)
 
You can find the VS search folders on Tools > Options > VC++Directories if you're on < VS10
On VS 10 that's on the project properties.
Well, copying the .dll to system32 is not that evil.
But I'm not sure it won't cause problems.
 
well, whew, that was fun
thanks guys
 
10:15 AM
From 3.10.10 / An lvalue for an object is necessary in order to modify the object except that an rvalue of class type can also be used to modify its referent under certain circumstances. [Example: a member function called for an object (class.mfct) can modify the object. ]
So, objects of class type are the exception... :-)
 
Well ... There can never be a const rvalue of primitive type
 
You mean rvalues of primitive types are always non-const?
That makes little sense to me.
 
I think it's more complicated
 
@MartinhoFernandes you mean that PATH variable which is also used for executables? Doesn't seem to works.. I found the directories in the properties folder, but what about just including it in the binary when building?
 
When undergoing lvalue to rvalue conversion, a primitive type never ends up as a const rvalue.
There is such a thing as a const rvalue for primitive types however
 
10:19 AM
@Nils You can build it statically.
 
how?
 
If you have a static .lib
 
yes I do
 
what's the name for the property of how many operands something takes?
 
10:19 AM
:)
 
a unary operator has a ??? of 1
 
Arity
 
@Nils Then you should tell VS to link with that.
 
arity...?
Oh... Luc beat me to it.
 
yea thanks :D
the last three letters of "unary" and "binary" etc are a giveaway, really
 
10:21 AM
It sounds really silly.
 
@TomalakGeretkal I gave my answer a major update:
8
A: If temporaries are implicitly `const`, how does this work?

FredOverflow I'm told that, in C++03, temporaries are implicitly non-modifiable. Wrong. Temporaries are created by evaluating rvalues, and there are both non-const rvalues and const rvalues. The value category and the constness of an expression are mostly orthogonal 1. Observe: std::string foo(); ...

 
@MartinhoFernandes It worked with putting it in PATH, just needed to restart VS, thank you
 
remove foo and bar no? Nevermind me. Too slow today
 
@FredOverflow It still doesn't even touch 3.10/10, which I feel is heavily pertinent
I changed the question title slightly, as I should have written "non-modifiable" rather than "const"
 
I used to like C++. It still do, but I used to too.
^ Abusing a Mitch Hedberg quote :)
 
10:28 AM
@TomalakGeretkal Why should I not be able to call a non-const method on a non-const object?
 
@Tomalak: yes, I think 3.10/10's relevance is in confirming the general expectation people have from builtin types, and that it explicitly doesn't apply to objects....
 
@FredOverflow That's the wrong question.
@FredOverflow rvalues are non-modifiable [except in certain scenarios]. I have shown that, with a citation. That is the core of the issue.
 
@FredOverflow Negation overload!
 
@FredOverflow The caveat is that the discussion stemmed out of a specific use of calling member function on an rvalue, which is allowed as a sort of exception to the rule
 
You guys do not get enough work to do from your boss.
 
10:30 AM
@wilx =)
 
It's lunchtime!
 
@Tony Where does it say that it doesn't apply to objects? And why would that be the case?
 
@wilx I'm on holiday!
 
:)
 
@Tony: It doesn't need to be the case, because we have the exceptional statement that member functions may modify the object.
I don't know what the other "certain circumstances" are.
Anyway, the answer is, "changing the wording slightly for the conclusion, objects, as accessed through member functions, are not inherently non-modifiable".
 
10:32 AM
@TomalakGeretkal Another update. Happy now? :)
 
@Tomalak: 3.10.10 (unless the old draft I'm consulting's out of date)... I quote the paragraph at ~19:15 above...
 
What I'm peeved about is that AFAICT the Standard is saying nothing: how can one attempt to modify an rvalue of class type? The rules about reference binding are enough to restrict what is or is not doable, combined with the signatures of the implicitly declared special members (if/when) applicable.
Although IIRC T().i 'inherits' rvalue-ness with C++0x; so perhaps in C++03 the paragraph applies here.
 
@FredOverflow Ish
 
You're missing the reference to the standard, aren't you? :)
 
@Tony Yes, that's the paragraph I quoted in my answer.
@FredOverflow Eh? No. I'm the one who provided a standard citation... you didn't...
unless I'm going insane
not impossible at this time on a Friday morning
 
10:36 AM
@TomalakGeretkal That's what I meant. You want a standard reference in my post, don't you? ;)
 
@LucDanton The question demonstrates a use case.
@FredOverflow Ah, yes, absolutely. It's all just one big assertion at the moment!
 
@Tomalak: "why would that be the case?"... the language has a way for the programmer to specify that they don't want a modifiable object returned (a const return object), but why not let the programmer decide? In some particular cases, the programmer may find it extremely convenient to perform chained modifications to results of expressions, building up a one-off value for a function argument etc.. Why restrict that arbitrarily?
For builtins, the language needs to provide a one-size-fits-all behaviour and opts for safety.
 
But, since I already covered that, you might as well leave your answer as it is.
No point having two the same.
 
right
 
@Tony I agree. I think we're talking about different things at the moment.
8 mins ago, by Tony
@Tomalak: yes, I think 3.10/10's relevance is in confirming the general expectation people have from builtin types, and that it explicitly doesn't apply to objects....
7 mins ago, by Tomalak Geret'kal
@Tony Where does it say that it doesn't apply to objects? And why would that be the case?
 
10:37 AM
@TomalakGeretkal I do not consider the paragraph necessary to mandate the behaviour of the snippet. But I'm afraid I'd need to dive into the Standard to substantiate that.
 
I don't understand how the paragraph says that it doesn't apply to [class] objects, or why it would do that if it did.
@Tony What it says is that it doesn't apply to calls to member functions.
 
But only objects have member functions... 1:1 ;-)
 
logic error detected
that it doesn't apply to calls to member functions, is NOT the same as it not applying to class objects overall
(please use "class objects"; built-ins are objects too)
 
0
Q: How can you modify an object without calling member functions?

Martinho FernandesAt 3.10/10, the standard says: An lvalue for an object is necessary in order to modify the object except that an rvalue of class type can also be used to modify its referent under certain circumstances. [Example: a member function called for an object (9.3) can modify the object. ] So, rval...

 
Ok... I'm using dated terminology re "objects"... point taken.
 
10:40 AM
@MartinhoFernandes :D
 
Hmm, Sasha raises an interesting point.
But GCC is happy.
That paragraph does not include changing member variables.
 
One would have to check e.g. whether T().i is allowed and if so whether is an rvalue or lvalue
 
@LucDanton heh, good timing
0
A: How can you modify an object without calling member functions?

Tomalak Geret'kalThis seems to be accepted: struct T { int x; }; int main() { T().x = 3; } Though I'm slightly surprised, because IIRC the LHS of op= must be an lvalue, yet the following implies that even T().x is an rvalue: struct T { int x; }; void f(int& x) { x = 3; } int main() { f(T...

 
LHS of op= for builtins must be an lvalue... class instances are different...
You can also do X a, b; (a + b).x = 3;...
Assuming operator+ returns a non-const X.
 
ok
Comment :D
no, don't
 
10:49 AM
@MartinhoFernandes Perhaps you should change the title to mention temporary objects or rvalues because there's already one answer that has been mislead
Make that two answers
 
agreed
well, no not agreed
the question is about modifying objects more generally, and it was posed because of a rule mentioned w.r.t. temporaries
 
I realize now that Martino intended the question as is, yes.
 
Given the function (not a template) T& make_lval(T&& t) { return t; } for a given type T (so no perfect forwarding)
then std::memset(&make_lval(T()), 0, sizeof(T)); is still well-formed is it not?
 
10:55 AM
(assuming T is a type that can be memset)
It's hard not to think that this particular paragraph is useless, really.
 
are you posting that, Luc?
 
No because it's fine
 
I need a link to it for another question really quickly :)
yes, then it's the answer to the question
 
what is being memset IMO is the parameter of make_lval, which is an lvalue and is passed as an lvalue ref (with the address then taken)
So I don't see how there is a sidestepping of "can't modify rvalues unless through a function member"
 

« first day (251 days earlier)      last day (4696 days later) »