« first day (260 days earlier)      last day (4688 days later) » 

4:47 AM
morning
 
sup dawg :D
 
Als
5:08 AM
bwah...
@DeadMG: good morning!
@DeadMG: what part of the world you are in? seems we are in similar time zones, it's morning for both of us..
 
hello all
 
Als
hola
 
 
2 hours later…
7:04 AM
I don't suppose anyone's online at this lonely hour?
 
Xeo
7:38 AM
Lonely hour? It's 9:30 am here. :)
 
8:03 AM
Hah, first playthrough of Fallout: NV — 42 hours.
 
 
2 hours later…
10:06 AM
"Your breasts should be back to normal soon." PHEW http://t.co/Y6azx74
0
Q: Can you solve this circular dependency problem in C++?

FrigoThere is an Object class with a clone() function that can throw a CloneNotSupportedException* and is declared such. CloneNotSupportedException derives from Exception, which derives from Object. Inheritance requires complete types, and we have two of them, so it's obvious we can't break the circu...

Oh my, the horror!
 
And is the "problem" trivial or what? Is he cramming everything in headers? How is the dependency circular?
 
AFAICT Object depends on CloneNotSupportedException which depends on Object.
But it sure seems easy to break.
 
But the first 'depends' is dubious
 
Hey, it's not my "design".
This sounds like someone that likes pain.
 
Do exception specs need a complete type? Who would care to know such a thing?
 
10:16 AM
mawning
 
Otherwise throw from the source file where the whole exception type is defined. Circular my ass.
 
Object.clone() method having a declared throw of CloneNotSupportedException would be utterly stupid, especially in Java.
 
it's utterly stupid, full stop
 
> A type denoted in an exception-specification shall not denote an incomplete type.
It's also trivial to fix
must upvote DeadMG's answer harder
 
you know
I've discovered a new irritation about people who tag C and C++ on the same question
not just the people who tag both when it's very clearly one or the other, but in addition
 
10:20 AM
@LucDanton Careful, so you don't break your mouse :)
 
people who tag both when they really mean something lower-level
like x86 or Windows API or something like that
which is not at all related to C and C++
 
The WinAPI is a C API. I can understand the C tag in that case.
 
no, it's got a C wrapper, it's an assembly API
 
Gah this guy is throwing a pointer. His problem really is not even circular. I sure hope it's a typo.
 
STL repeatedly saying "stud vector" and "shared putter" is starting to get on my nerves.
 
10:23 AM
@MartinhoFernandes Myself I feel weird when I hear about "stood vectors".
 
Or that.
 
@MartinhoFernandes Does he have a new video?
 
No, I've been watching the Advanced STL series.
 
Well, how would you pronounce them?
 
I pronounce them "s-t-d vector" and "shared pointer".
Mind you, the first one doesn't sound as bad in Portuguese where Sexually Transmissible Diseases are DSTs (Doenças Sexualmente Transmissíveis).
Which makes Daylight Savings Time look weird.
 
10:31 AM
Turns out, GCC doesn't accept a pointer to incomplete type in an exception specification. I'm not sure I wanted to learn that today and I'm not going to check if this is conformant.
 
well
AFAIK, pointers to incomplete types are valid, complete types themselves and it should be accepted
 
That was my idea too. I was going to write a comment about it but decided to test first.
Let's fire up clang to see what happens.
> error: pointer to incomplete type 'CloneException' is not allowed in exception specification
 
ugh
do not even post the name of that exception in the chat :(
having nightmares about it
 
I just rolled with the question.
 
I'm gonna go eat something
again
try and clear out the memories of that question
 
10:39 AM
To make you feel better, it's not the name used by the OP: he named his CloneNotSupportedException
 
ARGH
 
10:57 AM
> There is ABSOLUTELY NOTHING WRONG with my code, I checked everything (even INDENTS although C# is a static-typed language).
Hah, priceless.
 
lol
 
Well the number of tabs and spaces isn't going to change at runtime for shure.
 
It also has absolutely nothing to do with types.
@MartinhoFernandes Where can I read this quote?
 
@FredOverflow A static-typed language is one where the number of characters you typed doesn't change at runtime of course!
3
 
11:04 AM
And strong typing means hitting the keyboard really hard.
4
 
Manifest typing is when you shout each key you type!
 
11:57 AM
this guy thinks that this is a variable
5
A: Why is 'this' not volatile?

phlogratosthis is not a variable, but a constant. You can change the object referenced by this, but you can't change the value of this. Because constants never change, there is no need to mark them as volatile.

(in the comments)
 
Didn't you get the "extended discussion, move to chat" already?
 
nice when adding one more comment, one is directed to a chat window containing the comment log so one can discuss there xD
 
12:32 PM
@JohannesSchaublitb I added a comment with a quote from the standard regarding this.
Would be nice if someone upvoted it, so it is immediately visible.
 
Like this? :)
 
thanks :)
It's amazing how many people think that this is const.
 
plussed
lately i started not to quote the spec anymore so often
and in particular, i never give out spec refs. I only give out the text. so people have to search for the location themselfs
 
Searching for "this" in the standard is quite tedious ;)
 
then it's an excellent example where not pointing to the location is most effective
 
12:39 PM
You're evil.
 
that's just making sure the people talking to are familiar with the spec
 
To mix acid and water, what is the correct order? Acid on water or water on acid?
 
it makes no sense to quote the spec to someone who doesn't know that the template section comes after the class section
 
acid and water mix harmlessly
as water is neutral
 
which is what I'm trying to ensure by not giving location
is acid not toxic?
 
12:42 PM
however, I think the smarter thing to do would be to add acid to water
it is, but not to water
 
oh im such a chem noob
 
@DeadMG I'll try that. If I get burned, it's your fault.
Kidding.
 
lol
 
lol
hmm I'm in this GPG forum. how does this work??
"gas powered games" oO
fun. google image searching for similar images rock
 
@Johannes: oh hai, you may also find me there
 
12:46 PM
did a similar-pics-search on DeadMG's puppy
lol
 
lol
 
I think the question commenter got it absolutely right
 
do you know the reason why remove_member_pointer isn't there?
if it would exist, is_member_function_pointer wouldn't be needed likewise -.-
 
what on earth type would you get back from remove_member_pointer?
 
12:55 PM
The type it compounds
void(C::*)() -> void()
hm I guess it's ambiguous
it could also yield C
 
and I don't really see what you could get out of it, either
you'd still need a C object to get anywhere using it
 
is_function<remove_member_pointer<void(C::*)()>::type>::value would be true
template<typename T> using is_member_function_pointer = std::integral_constant<bool, std::is_member_pointer<T>::value && std::is_function<typename std::remove_member_pointer<T>::type>::value>;
 
1:09 PM
-1
Q: C++ making Hash of Arrays.

loldopI have a problem with the creation of a hash of arrays. I need a Single Key - Multi Data system: multimap <Type, vector<type> > var; But how I can add elements to the vector? Example: key = 3; Now I need to append some elements into the vector whose key is 3. Creating a temp-vec...

should be re-opened, it’s now a proper question
 
@MartinhoFernandes They always do, anyway.
 
1:59 PM
I wish there were a close reason "OP is a goddamn idiot with a bad attitude who is practically boasting of his ignorance"
 
I've seen those.
 
@jalf: For any specific question?
 
the one you answered, some Java-indoctrinated idiot who wants to throw pointers
 
ah that one
what a fun question that was
 
Oh, now he's arguing that C++ does not support Java design patterns. Awesome.
I'm starting to believe the GoF book did way more harm than good.
4
It seems like most people didn't really understand it.
 
2:09 PM
agreed
 
morning
 
ok
if I lose another 10 pounds, then I will be medically a much happier man
 
@MartinhoFernandes well, that's true. That's kinda why they're called Java design patterns, isn't it? ;)
I think I'll look at the bright side. His code isn't ever going to be my problem.
 
You hope.
 
@MartinhoFernandes where? link please
@MartinhoFernandes Seriously, what good did the GoF book ever do?
 
2:23 PM
It's linked back up in this chat.
 
Last time I read the GoF book, i kept stumbling upon the word "reuse", which is one of OO's empty promises.
 
@FredOverflow No idea. I never read it. But I was hoping there was at least some piece of goodness that could be extracted from it.
 
And the C++ code in the GoF book is absolutely terrible.
 
@FredOverflow It made it a lot easier to spot a certain breed of incompetent programmer. Doesn't that count for something?
 
Well, it was written before C++ was standardized. Maybe they should give it a major overhaul.
 
2:26 PM
I do find some patterns useful. Visitor, for example.
Visitor is in GoF, right?
 
You don't need Visitor in languages with multiple dispatch :)
 
Or pattern matching.
 
@MartinhoFernandes Interesting or useful? The visitor pattern is just another crutch for missing language features
 
Interestingly, there was a proposal to add multi-methods to C++, but not enough people pushed it for standardization in C++0x.
 
@jalf Useful.
 
2:27 PM
@MartinhoFernandes yes
 
> Of course I loved all of Design Patterns, except for pages 243 to 256, which had the magic property of inducing a coma-like trance whenever I tried to skim through them. I could put on a black ninja suit and sneak through the building, and presuming I didn't get arrested, I could tear those pages out of every single copy of Design Patterns at Amazon, and almost nobody would notice. That's because it's the most important one, so of course nobody gets it. I sure didn't!
What's this "most important one" that Steve Yegge is referring to here?
 
that passage of design patterns
 
And what pattern is in those pages?
 
Pages 243 to 256 are about the "Interpreter" pattern.
 
Ok, I have no idea what that is.
I mean, it's not about embedded DSLs or something, is it?
 
2:34 PM
> Given a language, define a represention for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
definitely not embedded
from skimming, it seems to be about parsing runtime strings
 
I don't see how important that is, but Steve seems to hold it in high regard.
 
Maybe because it allows building an embedded language that is more interesting than the host language, Java? :)
 
lol
that would not be hard in any way
 
Or maybe, the fact that that one is the most important says a lot about the rest.
Oh, there's a pattern named Iterator.
 
Als
Dynamic memory allocation with new[] and deallocating with delete.
Dynamic memory allocation new and deallocate it with free.
Dynamic memory allocation malloc and deallocate it with delete.
don't introduce memory leaks on windows and linux?
 
2:48 PM
I'd rather not know.
 
Als
Someone who agrees, that the statement is correct even for case 1?
All of them are UB for sure
hey there @MartinhoFernandes
 
@Als Nobody knows for sure, UB can result in anything.
 
Als
@FredOverflow: Yes i think so too, a comment on a answer, made me think if I am missing something..
 
@Als In practical terms, all three would probably allocate and free the specified memory block properly
 
You can neither say "delete array results in a memory leak" nor "delete array does not result in a memory leak". It may do anything.
 
2:52 PM
However, that doesn't mean they won't introduce leaks
since #2 doesn't call destructors, and #3 calls destructors, but not constructors
 
@jalf Erm, no? The heap and the free store may in fact be different memory areas in C++.
 
same for #1, of course. Would likely call the dtor on the first element in the array, but not the others
@FredOverflow I know. That's why I said "in practical terms", and "probably"
 
Also, delete[] on a non-array could immediately crash trying to read non-existent meta data.
 
Als
@jalf: Isnt it a leak then if destructors of only first element is called
 
That's why the question turns up so often: because beginners do it, and observe that it seems to work
 
2:53 PM
@Als It might be a resource leak, depending on the element type.
 
@FredOverflow none of his examples used delete[].
 
Oops, sorry, I overgeneralized.
 
@Als yup, potentially. Depends on what teh dtor does
 
@jalf A robust runtime environment should catch these kinds of errors.
e.g. Visual Studio in Debug mode.
 
@FredOverflow But you're right of course, strictly speaking, all of them are UB, so all bets are off
 
Als
2:54 PM
@jalf: I would reason, that the first case definitely causes a leak assuming the class has some dynamically allocated members being freed in destructors
 
@Als If you have such a nontrivial dtor, the second would fail too, because free() doesn't call dtors either.
 
@Als You cannot argue that UB definitely causes something. By definition, it doesn't.
 
The third one would probably just crash
again, in terms of actual implementation-specific observed behavior, even though they're all UB
 
Als
@FredOverflow: Yes, all of them are UB, and all code that uses them is offlimits and wrong
 
For example, trying to delete something that wasn't allocated via new is detected by my heap debugger:
4
Q: Critique my non-intrusive heap debugger

FredOverflowThis is a follow-up to Critique my heap debugger from yesterday. As suggested by bitc, I now keep metadata about the allocated blocks in a separate handwritten hashtable. The heap debugger now detects the following kinds of errors: memory leaks (now with more verbose debugging output) illegal ...

And I'm pretty sure Visual Studio detects that without additional tools in Debug mode.
 
2:57 PM
Ugh, didn't install glibc debug symbols, valgrind doesn't work.
 
I used a shared_ptr today, btw.
First time in, I dunno, a couple of years
usually use other smart ptrs whenever possible
 
So what did you share?
 
You selfish bastard!
Sharing is good!
 
@FredOverflow a win32 window class registration
 
nothing wrong with shared_ptr, but sharing should be avoided if possible
 
 
2 hours later…
4:30 PM
7
A: Can you solve this circular dependency problem in C++?

DeadMGSkip the exception specification, it's worthless. class Object { virtual Object* clone() = 0; virtual ~Object() {} }; Done. By the way, your design sounds so utterly wrong, I can't bring myself to not comment on it.

OK, the OP's code is terrible and disgusting
but did the question really deserve downvoting?
 
No. I don't think the question on its own is downvote-worthy.
But sometimes people downvote users.
 
5:02 PM
Lobsters may have longer lifespans, but can 1 lobster eat an entire human? I'm coming for you, you fucking lobsters.
 
 
2 hours later…
7:27 PM
hey
anyone here?
 
no
just you
 
brb
I have a bitstring with 4 ones and 4 zeros how can I generate all permutations, can you help me with that? Did this before, but forgot how..
I think I even asked about that before..
 
7:44 PM
I would shift the bits from right to left one after another
 
so you start with 11110000, then 11101000, 11100100 .. humm nah you need to do this in a recursive way
place the first 1 and then place all 1 for these wherever possible
brb
 
You can just look for the rightmost movable bit ant move it
until it's no longer possible
 
8:10 PM
good day all :)
 
@Nils Hm, I would probably just count from 0 to 255 and filter all numbers with 4 set bits... :)
Restricting the range from 15 to 240 might be even faster :)
typedef unsigned char byte;

int bitcount(byte x)
{
    static const int nibble_count[] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 };
    return nibble_count[x >> 4] + nibble_count[x & 15];
}

int main()
{
    for (int x = 0; x < 256; ++x)
    {
        if (bitcount(x) == 4) std::cout << x << '\n';
    }
}
 
8:40 PM
@Lounge<C++> Why you flag and increment annoying number in blue box.
 
8:55 PM
Oh great, now we have a starred flagged message. Let's see how the chat copes with it.
(I'm assuming the offensive part in that message is the mention of eating humans.)
 
9:13 PM
What msg got flagged?
lol, saw it already
 
@MartinhoFernandes or the word fucking
 
Which increment operator takes a dummy parameter when overloading? Prefix or postfix?
Is there some kind of rule I can use to never forget that?
Got it, it's the postfix version. All prefix operators have no parameters. That's a good rule.
@MartinhoFernandes Thanks.
 
9:28 PM
@MartinhoFernandes My 'rule' is that the canonical postfix implementation is in terms of the prefix one. So no dummy parameter for the operator that does the 'real' work, dummy parameter for the convenience wrapper
 
9:56 PM
Nifty, there's a std::nullptr_t in the new standard.
And it's only value is nullptr.
Meaning you can overload on it.
 
Absolutely
What I found amusing is that on GCC the implementation for it is typedef decltype(nullptr) nullptr_t;
 
It's how the standard defines it.
 
Ah well
 
10:24 PM
:( We can't default ctors with noexcept.
 
You can default the implementation if that makes you feel better
 
Nice. Thanks.
So that's what GCC meant by "defaulted on first declaration cannot ..."
 
Yeah
Defaulting on first declaration is oh so very stringent. It's a specialized tool I think.
 
10:52 PM
Hey
 
11:05 PM
Morning.
 
You're an early riser ;)
I'm going to sleep.
@CatPlusPlus Night.
 
Hi all
Is there any way to see how a compiler generated function turns out to be ( templates ). For example - template <unsigned int row, unsigned int column>
void myArray( int (&myArray)[row][column] ) { }
I am just curious to know how compiler is figuring out row and column
in this case
 
It's figuring it out from type deduction.
Have you tried having a peek at e.g. assembly output?
 
@LucDanton - Infact I never tried it for any kind of program
assembly output
 
11:20 PM
If you're not familiar at all with assembly then it may not be helpful.
 
@LucDanton - 3 years back I did assembly level programming 8085
But I don't think I remember it at all
now
 
In any case that's the only way to inspect what a compiler 'generates': dive into the output of the backend. If binary is not your thing, assembly is the next best thing (for most toolchains). You can also run a debugger but IME that doesn't give insight into the details.
 
Hello ;)
 
I think Clang has an IR as a possible output that is quite neat.
 
Guys, i'm stuck with this kind of problems : http://www.spoj.pl/problems/QTREE/
Is it connected with LCA?
because i don't know where to start with this and similiar problems :)
 

« first day (260 days earlier)      last day (4688 days later) »