« first day (461 days earlier)      last day (4473 days later) » 

10:01 AM
Wait, what is the correct syntax for alignas? alignas(X) struct blah {}; or struct alignas(X) blah {};? GCC accepts the alignment specifier pretty much anywhere, but I don't think that's standard.
 
Thanks. I found it. It's ugly.
It's the first thing for variable declaration, but after struct/class/etc for type declarations.
 
10:18 AM
Yay, I got through the damn lecture notes.
 
good kittie :)
 
@CatPlusPlus Does that mean you're ready to pass that thing?
 
Hell yeah.
There's also non-zero probability of brain melt.
 
hahah
when's your exam?
 
10:40 AM
Sometime between 15 and 20.
It's not written and there are queues.
So half the day bye bye.
 
1
Q: Is it "safe" on Linux to mix `new[]` and `delete`?

Lightness Races in OrbitSomeone on IRC claimed that, although allocating with new[] and deleting with delete (not delete[]) is UB, on Linux platforms (no further details about the OS) it would be safe. Is this true? Is it guaranteed? Is it to do with something in POSIX that specifies that dynamically-allocated blocks s...

Tomalak is asking crazy questions.
 
@RMartinhoFernandes do you guys have a faq on that one yet?
because that's probably the #1 most frequently annoying question I see
 
He's asking from POSIX perspective.
 
@jalf I don't think that would answer it.
 
Not crazy-language-mandated-UB one.
 
10:42 AM
He is asking about specific guarantees from a specific platform.
I think the answer is "no". I'll be running some tests...
 
It's silly question anyway.
 
@RMartinhoFernandes but he's still missing the fundamental point
the reason it is a bad idea is because it won't call the correct number of destructors
the specific platform can't change that
that's what people always forget. They just think that as long as it releases the right amount of memory, it "works"
because they just tested it with an array of ints
 
can someone tell me what this means: "Like a member declaration, a friend declaration does not introduce a name into an enclosing scope." I'm not sure what it means with "introduce a name into an enclosing scope" ?
 
sbi
@jalf Wait, weren't you the one who is opposed to closing valid questions as dupes of FAQs?
 
it gives an example:
 
10:48 AM
@sbi yup
 
sbi
Anyway, I don't think there's an FAQ. I link all such questions (from newbies, not from Tomalak) to this one.
@TonyTheLion "@sbi yup" — That's a meager example.
 
And I wouldn't miss the FAQ if you shut it down tomorrow. But I know you guys think it's a good idea, and this is a frequently asked question
it's also one with a very nice, simple and clear answer
People ask the question because they don't consider the relevant part of it (the destructors)
 
@jalf But it's not even safe with new char_with_dtor[1]!
 
class Matrix { friend class XForm; friend Matrix invert(const Matrix&); //.... }; XForm x; // error: no XForm in scope Matrix (*p) (const Matrix&) = &invert; // error: no invert() in scope
 
sbi
@jalf So you despise the idea of doing this, but since we do it anyways, you wouldn't mind to benefit? :) I see what you did^Wwere trying to do there...
 
10:50 AM
@RMartinhoFernandes no, but it might work in practice
 
@jalf It doesn't.
I tested it.
 
Science!
 
@sbi I didn't say I'd benefit
 
sbi
@RMartinhoFernandes It officially worked with Borland C++ 3.1. I don't know about later versions, though.
 
@RMartinhoFernandes it might work with some compilers. :)
 
10:51 AM
@jalf Not with GCC on Linux.
> *** glibc detected *** ./g02: munmap_chunk(): invalid pointer: 0x09cba00c ***
 
sbi
9 mins ago, by jalf
because that's probably the #1 most frequently annoying question I see
Of course, not!
 
yes, it's an annoyingly frequently asked question. But for me to benefit from it going in the FAQ, I'd have to believe that the FAQ actually solved that problem
I don't. But since you believe otherwise, I figured you might want to add the question to the FAQ :)
 
ok here is the whole thing which I don't get
 
@RMartinhoFernandes yup, makes sense, but again, by thinking about the destructors, rather than the memory, the answer is clear. Because delete[] has to have a way to know how many dtors to call. So it has to do something extra on top of what delete does (read the number of elements from somewhere)
 
@TonyTheLion Well the scope that Matrix is in.
Here it's global one.
 
10:55 AM
and that implies that the number of elements has to be written in the first place (by new[]), and there's no reason for new to do it
 
@jalf Ha! But what if both new[] and new store a thunk that does the appropriate deallocation?
 
but why would it?
 
@CatPlusPlus ah right, I get it now
 
And then delete[] and delete could be the same.
 
sure
but the only advantage would be to allow you to write UB and have it "work"
it'd take more memory, be slower and more complex, and there'd be no real benefit
but sure, it could be made to work
 
sbi
10:58 AM
@RMartinhoFernandes Then It Just Works™, which is just one way of UB to manifest itself.
 
@sbi But POSIX could require it from compliants systems (it doesn't, POSIX knows nothing about C++).
 
@RMartinhoFernandes sure, it could. Your point is?
 
sbi
@RMartinhoFernandes It would still be UB according to the C++ standard. Only it would be UB which you could expect to manifest itself in a certain way on POSIX-compliant systems — according to POSIX.
 
@jalf That the question is not entirely silly.
 
Your Window manager could require it too. Or your keyboard driver. Or some patent covering your monitor
 
sbi
11:01 AM
@jalf I dislike anything covering my monitor. Even patents.
 
@RMartinhoFernandes I never said it was silly. I said it was frequently asked, and that the reason it is frequently asked is because people forget to consider the relevant part, and merely think in terms of memory (de)allocation
if you think about destructors, then it becomes obvious that "they could be interchangable, but it'd be needlessly complex, and there's no reason for them to be so"
 
Then we agree :)
 
What did I do wrong here ?
 
Friends are free functions.
 
sbi
@TonyTheLion 'class Foo' has no member named 'f' What more do you need?
 
11:07 AM
I don't think friends work like you think they work
 
@sbi I thought that declaring f() to be friend of Foo would let me call it through Foo
 
sbi
@RMartinhoFernandes If everyone I befriended became my member...
 
that's why I was confused
@thecoshman seems that way
 
sbi
@TonyTheLion No. Why would it? All befriending allows is the proverbial "touching of private parts".
 
Why would it do that?
 
11:07 AM
@TonyTheLion no, it means f() can access private stuff of a foo object
@sbi I don't think that will hold up in court
 
Your members can already touch your private parts. Masturbation wouldn't work otherwise.
 
sbi
@CatPlusPlus Um, because that's what it was invented for?
 
@sbi right, but when you do operator overloading through friend functions, the overloaded operator is called through the class instance no?
 
sbi
@TonyTheLion No. See this answer.
 
@RMartinhoFernandes euh, this wasn't a sex discussion.
 
11:09 AM
friendness doesn't change the function's calling convention, that would wreak havoc.
 
@sbi every time someone answers "No" like that, I get this picture
 
@TonyTheLion You were involved...
 
sbi
@TonyTheLion That looks way too friendly for me saying No!
 
@sbi hahah
@sbi ah, thanks for that.
 
@TonyTheLion A gorilla's No! is much more frightening than that :p
 
11:20 AM
@sbi woah, talk about covering your ass. well done :D
 
sbi
@thecoshman ??
 
@sbi I am complimenting you on writing such a complete answer, I also like your use of previous questions
and I wonder how deep this goes, one answer leads to another, and another :P
 
sbi
@thecoshman Ah, that's what you were getting at. Well, see the comment:
> FWIW, writing this took the better part of my Sunday, an article draft that actually was meant to get published one day, and a big overdraw on my good-will credit with the kids (who wanted me to play LEGO with them instead). Please don't begrudge me the rep I get for it.
:)
 
¬_¬ I wish I could use C++ again
 
sbi
11:36 AM
I'm speechless. Could somebody please step in and explain this guy how stupid this is? I don't know where to start.
 
@thecoshman Just like a rabbit hole!
 
@sbi don't know enough to really comment
 
@sbi What's so wrong? The use of 1 and 0 instead of true/false?
Oh, ugh.
 
@sbi you really should explain why he is being an idiot, no one learns from being hit with a stick
 
Damn, that's fugly.
@thecoshman Dogs do.
 
11:44 AM
@RMartinhoFernandes animal abuse aside for the moment; Dogs aren't people
 
@sbi it is ugly as heck, but it works and is valid. Binary predicates are required that bool(pred(*it1, *it2)) works. In this case, it does.
 
sbi
@RMartinhoFernandes It's still nonsense to use void*, and IMO warrants a -1.
 
oh god! A Schroedinger bug! (I hope I got the right name there)
turn on traces, and the bug vanishes!
 
@sbi I upvoted everything else instead :)
Minus the question.
The question is fugly as well.
 
Argh, people who go around downvoting old answers
-1
A: What does this structure actually do?

Alf P. SteinbachIn C++ simply use std::complex<float>.

 
sbi
11:52 AM
@AlfPSteinbach Yeah, this is annoying. Upvoted.
 
on the silly side, just got the "pointers" badge
:)
 
Oh, I'm about to get that one. Once I have enough answers.
 
sbi
@AlfPSteinbach Whom does the badge point at? :)
 
It's silly that I already have the points, but need more answers.
 
sbi
Was cppreference.com the Good One™ or was it the Evil One™? And if the latter, what was the URL of the better one?
 
11:54 AM
2
A: Bypassing Browser popup blocking when automatic session timeout occurs

thecoshmanIf the browser has blocked use of pop-ups in JavaScript, it has blocked them. There is no way you can force the browser to let them through. You can always try creating a pop-up like element on your page, it won't force the user to deal with it first (except on your page) but will still 'look' ...

 
@sbi The good one.
 
@sbi i think that's the good one
 
I was accepted answer on the for a long time... just noticed that the accepted answer was changed
 
BAM, -15 points!
 
sbi
I never was an accepted answer. I wrote some, though.
 
11:56 AM
@sbi ¬_¬ oooh you
 
last night I dreamt that robots had taken over the world. I , together with a cat , a puppy and an ape devise a plan to defeat the robots. we build a giant magnet that attracts all the metallic robots and that launch the magnet to outer space taking the robots with it. ¬_¬ I think I'm going bananas.
 
The moment I get around to the interesting part is the moment "Internal compiler error: Error reporting routines re-entered." pops again. Ugh.
 
@IntermediateHacker I'm made of hi-tech plastic.
 
@AlfPSteinbach so, did everyone see this: blogs.msdn.com/b/visualstudio/archive/2012/01/18/…
speaking of badges
 
@RMartinhoFernandes damn you, robot! grrr...
Is there a way to attract high-tech plastic?
 
12:12 PM
I think you would need to know more about this undisclosed variant of plastic.
 
I think you're just made of low-quality scrap metal. >_<
not even bio-degradable.
 
@IntermediateHacker wtf?
 
@IntermediateHacker Of course it's not bio-degradable. I want to stand forever.
 
He wants to forever leave his mark upon this room :|
 
@RMartinhoFernandes then, is there any way to defeat you? what about those organic matter eating bacteria?
 
sbi
12:27 PM
@IntermediateHacker Charge him to cook a meal. See, there, defeated.
 
Is it normal a TU is made up of 74k lines? That's the preprocessed source though.
 
I guess that if you include some parts of boost you could get that.
 
sbi
@LucDanton Add #include <windows.h> and you add several 100k lines to your TU.
 
I'm trying to understand why adding a few lines to a header makes GCC cry.
 
sbi
@LucDanton 74kLoC is nothing. It must be something that's in those lines.
 
12:30 PM
@sbi Thanks for the pointer.
Let's see if it's mangling then.
tree check: expected tree_list, have H‰   ß   è   MÕ   þÿƒ         ø   txƒ   ø   tsƒ   ø   „   º in eq_local_specializations, at cp/pt.c:1687
Please submit a full bug report,
with preprocessed source if appropriate.
wat.
An entity from beyond our mundane dimensions has taken possession of my compiler. Please advise.
5
 
Ow.
Is that hpl++?
 
I only know of Hell++.
Also, I'm saving that error message for posterity.
 
H.P. Lovecraft ++.
@LucDanton Anyway, sounds like perfectly valid UB :P
 
@RMartinhoFernandes Come to think of it, it's true I've never had much UB happens at compile-time.
 
0
Q: What should the meta "trolling" tag be?

C. RossWhat should the meta "trolling" tag be? Currently there are three related tags troll x2 trolling x14 trolls x1 Which tag should we use when referring to issues with trolls on the SE network?

lol
 
12:39 PM
Interestingly(?), the binary mess is not random, I get the same (at least for those characters I can see) stuff everytime.
 
Well, sounds like a reproducible bug. Are you filing it?
 
Only way to reproduce so far is to use the 73k-line preprocessed source unfortunately.
Doesn't appear to be mangling, or at least where I thought it would be.
Meh, pause time.
 
@RMartinhoFernandes could just use
 
@RMartinhoFernandes sorting and real serious issues I see
 
12:50 PM
> Also this is a level 5 pointer i'm working with, i've only used level 1 or 2 pointers but i'm guessing it's around the same. Just read the address from the pointers until I get a base address to write to.
I stopped reading after this.
 
@RMartinhoFernandes you need to have the black belt in pointers to work with a level 5 pointer :o
serious business
 
That or a straitjacket.
 
Xeo
C'mon, a level 5 pointer is nothing that serious. It's just pretty useless.
 
And the work of a madman.
 
1:02 PM
but what is it?
int*****?
 
I suppose so, but it's not entirely clear.
I didn't read the whole question, for reasons that should be obvious.
Look, Java.
0
Q: what design pattern to use for different base object procedures

joecoso i'm writing sort of an engine where some functionality exists but i want to leave the room to add more functionality. So consider these classes to exists in the engine class Object { public: Object(){}; virtual ~Object(){}; ActionProc* pAP; }; class Sphere: public Object { p...

 
Is Tomalak really that stupid?
 
What happened?
 
@RMartinhoFernandes just his question about mixing new[] with delete
I'm actually having to count ctor and dtor calls for him just to show that the effect is different
 
Ah, I see...
I never thought he was stupid (at least not in that sense).
Yes, he's a bit... confrontational, but not that kind of stupid.
 
1:12 PM
Yeah, that's what I thought
but this just seems like stupid
 
1:30 PM
true story...
 
lol
 
1:44 PM
 
1:54 PM
Why Clang has no constexpr >:s!!!!!
 
Xeo
@rubenvb It has, syntactically.
They're just not completely working sementically
 
It's just time to admit that GCC keeps on being awesome.
 
Xeo
C'mon, Clang is just missing a few features.
 
sbi
Wait, what? "I removed flag weight."
 
Yet possessed.
 
sbi
1:56 PM
@Xeo It's indeed gone.
 
@RMartinhoFernandes Perhaps this is in fact the source of its awesomeness!
Deal with the devil, so to speak.
 
@sbi You did?
;)
 
Xeo
@sbi Are they kidding me?!
 
@RMartinhoFernandes do you need a lesson in what quote marks mean?
 
damn, I have 6 helpful flags
I had flag weight of 170
 
1:58 PM
@thecoshman Do you need a lesson in what sneaky edits mean?
It's not gone.
It's just not shown on the UI.
Everything else works the same (well, except the badges are easier to get).
 
static_assert+no constexpr == uselessness
 
Clang is just no fun.
 

« first day (461 days earlier)      last day (4473 days later) »