« first day (433 days earlier)      last day (4529 days later) » 

12:10 AM
is there a place on the internet where I can just copy the vector methods into a header to get started on a new container?
 
Xeo
@MooingDuck Huh?
 
Edit button went crazy:
 
@Xeo Nevermind, I'm just being lazy
 
 
Xeo
lol
2
A: Distinguish if program runs by clicking on the icon, typing its name in the console, or from a batch file

tcovoHere's the fun way, I don't think it's much trouble: You can use the GetConsoleProcessList API function. It returns a list of processes that are attached to the current console. When your program is launched in the "no console" mode, your program is the only process attached to the current conso...

The OP's comment
I'm inclined to just reply "Well, don't fuck around with ancient software then."
But that would be mean
 
12:21 AM
Was windows 2000 the one nobody liked? Or was that ME?
 
Xeo
Both? /shrug
 
I like stack overflow questions on StackOverflow
 
Xeo
12:37 AM
2
Q: C++ template typedef as template function argument

JoséWhy doesn't the compiler find a match for read1? I don't see the difference between read1 and read2; is there a limitation for nested typedef templates like the one in the Foo class? template<typename T> class Handle {}; class Foo { public: typedef Handle<Foo> Handle; }; templ...

Some questions are just... wow.
And why the fuck does that get upvotes?!
Hm, SO only offline for me?
 
Nope, offline for me too
What was the question about?
 
Xeo
template<class T>
void foo(typename T::a_typedef){}

// call
Bar::a_typedef t;
foo(t);
And expecting that to work.
 
Is it possible that the copy constructor of boost::filesystem::directory_iterator gets implicitly deleted?
I get this error for using an implicitly deleted copy constructor of directory_iterator, but I can't find exactly what triggers it, or reproduce it into a simple snippet.
And I only get this error in a snapshot of gcc47. I don't get it in gcc46.
 
Stack Exchange is currently offline, we'll be back shortly! Never seen that before
 
I hate them for that. so unprofessional. what reason on earth have you for taking an entire site offline? the shoemaker walks barefoot, as they say.
 
Xeo
12:47 AM
Double-buffering is not only useful for graphics...
 
@wilhelmtell database crashed?
 
Xeo
Well, it was hella slow before it went down for maintenance
 
A site this large running off only one database?
 
Xeo
Atleast the chat is still there
 
they have an uptime of about 80%. it's not like they're serving videos or anything like that. and they're not a huge website. big, yes, but not huge. there are huge websites out there that have a significantly better uptime. and they're modest about it, they don't even boast about themselves every week in a podcast.
 
12:50 AM
Interestingly enough, sstatic.net is also offline. Probably not database
 
argh boost::filesystem::directory_iterator brings the worst out of me.
 
I've never used boost::filesystem::directory_iterator, from the name it sounds rather useful but from your comments it sounds rather useless
 
i didn't say it's useless. just that i'm too stupid right now to understand what changes in gcc47 broke my code. presumably somewhere in my code i had undefined behaviour and it exploded in my face (at compile time, thankfully praise the lord halleluja bacon).
gcc47 said something about a move ctor or move assignment defined, which render the implicit copy ctor ill-formed, thus implicitly deleted.
and on the face of it it sounds like a bug in boost. because then the copy ctor should be defined explicitly.
 
Xeo
Can you make an SSCCE out of it? I could test against Clang 3.1
 
but the chances that i'm wrong and stupid are considerably higher than that of boost being wrong.
sscce?
 
Xeo
12:57 AM
 
Small Sausage Compiled with C++ Embdedded?
ah
 
Xeo
Small, self-contained, complete example
 
yeah i'm still trying to reproduce that.
i have it in a not-so-tiny codebase right now. haven't figured what triggered it, so haven't extracted it into an ssccee yet...
but it's only in a late snapshot of gcc47. gcc46 doesn't trigger this.
 
not a compiler bug?
 
ah, the day you'll hear these words coming out of my mouth ...
i think i'll have enough confidence to add a digit to my paycheck then.
 
1:01 AM
My boss joked that if I asked for another digit on my salary he'd put a zero on the front and make it octal
 
Xeo
lol
 
pad the zero with an x and say "k, your turn"
 
I wonder if the compiler is smart enough to optimize out the instructions of zeroing out primitive members in a destructor. Probably.
 
Would it need to zero them out anyway?
 
I guess it depends on where you do that. I mean, optimizations are all about the observable behaviour.
 
1:07 AM
@MooingDuck I wonder if it is legal to do so.
 
@curiousguy any optimization is legal so long as the observable behaviour is standard conformant. except for the RVO, which doesn't have to conform even in observable behaviour.
 
@Xeo I have more trust in null pointers failing
 
Xeo
@MooingDuck Make them 0xDEADBEEF
 
@wilhelmtell Is the observable behaviour the same?
 
@curiousguy for zeroing out a pointer right before it's destructed? Yeah, its the same
 
Xeo
1:09 AM
@MooingDuck Null pointer could mean default constructed class
 
@MooingDuck presumably you can just turn off all optimizations and not worry about it. something like -O0 in gcc.
 
@MooingDuck: Ohhhhh sorry I missed the context. Makes sense. I would probably say it would omit the zeroing because, is there any standards conforming way to access that memory otherwise?
 
i do that anyway in debug builds. -g -O0
or -g3
 
@MooingDuck Do you mean that you cannot observe the value of these objects?
 
@Xeo either way it's invalid to play with it, and should fail ASAP
 
1:10 AM
I am not sure.
 
@curiousguy not within defined behavior, so it should be fine to optimize it out
 
@dreamlax I think so.
@MooingDuck reference?
 
If there's no standards conforming way to read from a destructed object then the optimiser would surely ignore "seemingly-useless" assignments in a destructor
 
presumably
 
If a class contains a member of type int, does the int still exists after class destruction?
 
1:12 AM
@curiousguy actually, now that I think on it, I'm unsure. An allocator could presumably legally read the bytes leftover in the allocated buffer after an object was destroyed...
 
I would say yes, intuitively.
 
no
no it doesn.t
 
@curiousguy no it doesn't
 
??? what
 
you should read the gotw about object lifetime.
 
1:13 AM
why would the int still exist? Unless it was static
 
@MooingDuck How do you conclude that?
 
an object doesn't exist as soon as destruction starts.
 
Xeo
@curiousguy If you do foo.~foo();, the region of memory still exists
but the object itself is gone
 
it is no more. it has ceased to be. this. is an ex-parrot.
 
Xeo
if you delete pfoo;, everything is gone
 
1:13 AM
it doesn't exist after destruction ends, otherwise destructors would be pointless
 
@Pubby how could an int not exist?
As long as the memory is there.
 
@curiousguy the object doesn't exist. The memory space it was using still exists physically. It's a legal thing
 
what type of question is that? Memory and objects are two different things
 
@curiousguy ok so add UB to your reading list.
 
Interesting topic for discussion, but unfortunately I gotta shoot the gap. Bye all
 
1:14 AM
@MooingDuck how could an int not exist?
 
Xeo
@dreamlax He's fleeing! Grab him!
Oh, SO is back up
 
@wilhelmtell add "stop being condescending" and "stop silly hand-waving" to YOUR reading list
 
Last day of work today. It's 2pm on Friday and the boss said "go home" so I'm not staying
 
@MooingDuck again, how do you conclude that?
 
@curiousguy
 
1:16 AM
@curiousguy Could you explain exactly what you are talking about? The int ceases to exist when it is destructed.
 
When does an int exists?
This is a real question.
 
@curiousguy k
 
@Pubby I can't be clearer.
 
int x; // int exists
 
When does an int object exist?
 
1:17 AM
@curiousguy void foo() {int thingy;} int main() {foo(); return 0;} . after the call to foo returns, the int thingy no longer exists. There is still space for it, but as far as the C++ language/compiler is concerned, it's gone.
 
i already said i'm in a foul mood today. blame gcc47 or my bad code, your choice.
 
@curiousguy when it's in scope. Between construction and destruction.
 
it doesn't have to be in scope
 
@MooingDuck when what is in scope?
 
@Pubby say wha? I thought everything in C++ has a scope
@curiousguy when the int is in scope.
 
1:18 AM
An object does not have "scope".
@MooingDuck Names have scope.
 
@curiousguy all objects have scope. Are you talking about C++?
 
@MooingDuck new
 
@MooingDuck that doesn't make sense.
@MooingDuck source?
 
@curiousguy alright, looking in the standard....
 
This discussion is making less and less sense.
 
Xeo
1:19 AM
@curiousguy The standard
 
@MooingDuck after foo returns, the memory for thingy is not usable by the program.
Of course, after memory is unallocated, it doesn't make sense to talk about objects in this memory.
 
@Pubby you're correct, dynamic objects do not have scope
 
@Pubby then it never ceases to exist
 
it ceases to exist when delete is invoked
 
OK, but we are not invoking delete or returning from a function.
The context of the discussion is :
 
1:23 AM
pointer member of a class
 
??
 
@MooingDuck here.
We are calling a destructor.
 
what's the discussion?
 
What is the effect on subobjects?
 
3.8 "The lifetime of an object of type T ends when:...the storage which the object occupies is reused or released"
 
1:24 AM
member variables are destroyed after destructor finishes
 
@curiousguy this message is a reply to curiousguy's point of debate
 
So the lifetime of the int subobject does not end, because the storage is not released nor reused.
 
what are you talking about
it's part of the class that contains it, which is released
therefore it's released
 
@Pubby no, by hypothesis the class is not "released"
 
???
 
1:27 AM
the destructor is called
 
what?'
 
Again: an object is destructed
 
assume memory released after destructor finishes
 
@Pubby he's saying the memory is not released or reused. Therefore the int object still is technically still alive. I can't find anything in the spec to refute him.
 
Does this imply that the lifetime of all subobjects end?
 
1:29 AM
3.7.5 "The storage duration of member subobjects, base class subobjects and array elements is that of their complete object"
 
what's your example code?
 
@Pubby That is not the hypothesis.
 
@Pubby there is no code, this is a language lawyer thing
 
struct T {
	int i;
	~T () { i = 0xDEADBEEF; }
} t;

int *pi = &t.i;
t.~T();
cout << *pi;
 
@Pubby actually, spec says object's lifetime ends when the destructor call starts.
 
1:32 AM
@MooingDuck You can certainly still use the object after the start of its dtor.
 
@MooingDuck What?
 
3.8/1 "The lifetime of an object of type T ends when:
— if T is a class type with a non-trivial destructor (12.4), *the destructor call starts*, or
— the storage which the object occupies is reused or released."
 
@MooingDuck What does it mean?
 
ok, right now i start to think that maybe boost::filesystem v3 does have a bug here.
 
Xeo
@wilhelmtell Check their bugtracker?
 
1:35 AM
@MooingDuck so the int subobject still exists, and my code is valid.
 
@curiousguy since it's undefined behavior to access an object outside of it's lifetime, that means you can't.
 
I'm very confused, how can destructors work if the objects lifetime ends before they are called?
 
because the reference at boost.org/doc/libs/1_48_0/libs/filesystem/v3/doc/… states there's a copy constructor, and it implies it's defined explicitly. but i just looked at the code, and it's clearly not defined explicitly.
I have boost 1.48.
 
@Pubby imagine the first line of a destructor executes. Do you consider the object still alive and valid? No, of course not. Hmm, I just realized there's a contradiction here.
 
How can any cleanup be done?
 
1:37 AM
@MooingDuck I can't do what?
 
You guys are going to make me late to my girlfriend's house
 
The quoted text means that my code is well defined, prints DEADBEEF.
 
it's not well-defined
 
"there's an xkcd for that" is the geek's "there's an app for that".
 
1:38 AM
@wilhelmtell yeah, that
 
Xeo
@wilhelmtell There's an xkcd for everything.
 
@MooingDuck this means that the compiler cannot optimise out the assignment in the dtor
 
@wilhelmtell my girlfriend just sighs when I say "that reminds me of an xkcd comic...."
 
@MooingDuck with good reason.
:p
one of the things i find most difficult in life is making the switch. the switch from work to home, from home to work, and from C++ to girlfriend.
interestingly usually i have no problem making the context switch from girlfriend to C++.
 
@MooingDuck The behaviour during destruction is described in Construction and destruction [class.cdtor]
"Member functions, including virtual functions (10.3), can be called during construction or destruction (12.6.2)."
 
1:41 AM
@Pubby I almost think we found a contradiction in the standard. There's a part that says "the lifetime of member subobjects is described in 12.6.2" BUT IT'S NOT THERE
 
"To explicitly or implicitly convert a pointer (a glvalue) referring to an object of class X to a pointer (reference)
to a direct or indirect base class B of X, the construction of X and the construction of all of its direct or
indirect bases that directly or indirectly derive from B shall have started and the destruction of these classes
shall not have completed, otherwise the conversion results in undefined behavior."
 
I'm going to ask a question on it, but first let me check something
 
umm, boost::filesystem isn't in C++11, is it?
 
This means that the behaviour during c|d tion is special.
 
12.7 "For an object with a non-trivial destructor, referring to any non-static member or base class of the object after the destructor finishes execution results in undefined behavior."
BAM
 
1:43 AM
@MooingDuck proof?
 
@curiousguy yeah, that's the proof
 
@MooingDuck can you give it?
 
ok this is interesting. directory_iterator doesn't define any move ctor/assig either.
 
@curiousguy What? that's it! section 12.7!
 
so this must be a case of a move-ctor implicitly defined. one of those corner cases presumably.
damn why am i debugging a boost library?
 
1:45 AM
@MooingDuck No.
 
@curiousguy it is undefined behavior to refer to a non-static member of a destructed object!
@curiousguy what do you mean no?
 
@MooingDuck Where I am doing that?
 
@curiousguy You destructed T!
 
I am not using t after destruction.
 
@curiousguy the question was if it's defined behavior to refer to a member pointer of a destructed object after destruction
 
1:47 AM
t does not even appear in the source code.
 
@curiousguy you're refering to a nonstatic member of t.
 
@MooingDuck No.
 
@curiousguy Are you trolling me? You are, aren't you?
 
There might be a double destruction problem, OTOH.
@MooingDuck No.
 
@curiousguy there is that as well, yes, but I was ignoring that
 
1:48 AM
Assume that double destruction is avoided.
 
0
Q: Lifetime of object is over before destructor is called?

PubbyI don't understand this: 3.8/1 "The lifetime of an object of type T ends when: — if T is a class type with a non-trivial destructor (12.4), the destructor call starts, or — the storage which the object occupies is reused or released." If the lifetime ends before the destructor starts,...

 
I am not using the object t at all after destruction.
 
struct T {
int i;
~T () { i = 0xDEADBEEF; }
} t; // t (and members) constructed

int *pi = &t.i;
t.~T(); // t (and members) destructed
cout << *pi; //t's int member is _referenced_ (not by name, but still)
@curiousguy doesn't matter, you're still refering to it's member via pointer
@Pubby there's special rules allowing constructors/destructors to do stuff during the process, but the object is not "live"
 
@MooingDuck If you know the answer then post it
 
@Pubby I had it a moment ago, but closed it, because I'm already 51 minutes late.
@Pubby sorry, going now. bye
 
1:52 AM
bye bye
 
@MooingDuck I disagree.
The ice may be thin, but I am confident.
I took care of saving &t.i when I could.
The standard is not worded in term of lvalue, but it is clear that it is concerned with forming the lvalue t.i, not accessing the value of t.i.
 
what?
 
There is clearly an error in the quoted text.
It speaks about pointer and accessing the value... this is clearly an error.
 
???
 
I read it as saying: To form <del>a pointer to (or
access the value of)</del><ins>a lvalue refering to</ins> a direct non-static member of an object obj,
"To form a pointer to (or
access the value of) a direct non-static member of an object obj," is bad standardise.
The author is obviously confused.
This is difficult to read and does not support the author's intent.
 
2:05 AM
if you think it's incorrect then submit a defect report
although it will most certainly get rejected
 
When standard text is difficult to read or unreadable, I first rewrite it to express what the author tried to say.
This is very often necessary, because the authors are quite bad.
They just don't know how to write specifications.
@Pubby why?
Because DR get rejected for bogus reasons?
 
???
 
I know that.
 
if you think it's incorrect then ask a question on SO
I don't get what you're arguing
 
I am not arguing one thing in particular.
Just saying that this paragraph obviously is wrong.
It might be interesting to know for how long this standard text has not been changed.
 
2:10 AM
@Pubby I think Kerrek and Andrew White's answers make sense - as far as the outside (consumer) is concerned, the instance in concern becomes invalid once it enters the destructor...
 
I think that there is some dust over there.
@kfmfe04 the standard is concerned with "the user".
The user is not the consumer (outside).
The user is the C++ program.
 
but within the C++ program, you can identify things like the caller/callee, the user of a class/the implementation of a class (outside vs inside), etc...
so, inside the destructor, "this" is not dead yet (otherwise, it can't do things like clean up and free memory)

however, from the outside, that instance is effectively unusable
in a single-threaded app, the distinction may not make a big difference, but in a multi-threaded app, it will make a difference
 
@kfmfe04 what is the "outside"?
@kfmfe04 In a single threaded app, you have functions calls too. ;)
 
"outside" is the point from which the destructor is called

- in RAII, it could be a closing brace
- it could be the point where a deliberate delete f; is called
- it is the point if you place a breakpoint in the destructor and go "up" in gdb
 
2:32 AM
Dang, fell asleep while watching The Cleveland Show, and now it's 3:32 a.m.
 
Xeo
fell asleep on your keyboard, atleast?
 
Nope, in bed.
 
Xeo
So... I clearly got no idea how to use git. Anybody mind tutoring me? =D
 
@Xeo hahaha - I'm the same: transitioning from svn to git has been on my TODO list for like a year now
 
Xeo
Damn, where is that robot when you need him.
 
user406009
2:40 AM
Is it valid for a function that is extern C to have C++ types in the function call?
 
user406009
Like this
 
user406009
#include <map>
extern "C"
{
   void why(std::map<int,int> aMap,int sane);
}

void why(std::map<int,int> aMap,int sane)
{}
 
Xeo
@FredO, do you know how to use git? :s
 
@EthanSteinberg afaik, no - the "C" part would have to know about the C++ mangler, etc...
 
@Xeo I can play the guitar, if that helps.
 
Xeo
2:46 AM
heh
 
3:00 AM
I love threading: just cut a 74m run down to 49m (33% reduction) on a 2-core machine - going to tweak it a bit more: I think I get I/O-bound towards the last third of the run
 
Xeo
Omg, it works
In all tutorials I always see only $ git push, which did.. nothing for me "everything up-to-date". $ git push origin master did the job ♥
 
git push origin master sounds rather spiritual...
 
Xeo
heh
If that helped, I prayed a few times throughout the testing
 
3:15 AM
git, svn?/ I find it simpler just to backup my stuff on 3.5 inch floppies.
 
Xeo
You must have many then. Did you build your house out of them?
 
Xeo
Also, you still have a floppy drive?
I think you'd have to specifically ask for this when building a new rig..
 
Believe it or not; they still sell floppy drives --- google.com/products/…
 
Can you still buy the disks?
 
Xeo
@IDWMaster I know, but no sane computer vendor will have one builtin into the pcs
Which is a bit sad tbh
They're a great last resort kind of thing
 
@RichardPennington I just use Dropbox ;)
 
Xeo
If you have a bootable usb stick though, you're better of with those
@FredOverflow Some of the teams at the Games Academy used Dropbox as a VCS.. for the whole game project
The mess, it was unbelievable
 
@Xeo Why not use GIT?
 
Xeo
3:21 AM
1) we were only tought SVN
2) they didn't even think that SVN was needed, only dropbox
3) most of them didn't have a fucking clue how SVN worked *and then give them git?!*
 
@Xeo I think Dropbox works okay as a VCS if there's only one developer.
 
@Xeo Why stick only to what you are taught? This seems to be a very typical problem at these universities....
 
Xeo
@FredOverflow No, it doesn't. You can't really control when you commit, the revision history is limited, and it is suck as a VCS for developing.
 
@Xeo You commit every time you save :)
 
Xeo
@FredOverflow Are you sure you want that?
 
3:23 AM
I said it "works okay", I didn't say it is awesome :)
 
Xeo
I mean, you could also disconnect dropbox to stop the automatic updates, and just reconnect it when you want to "commit", but that is more like a hack
Also, if you commit every single time you save, you will have a rather uninteresting revision history (that is limited to like 5 revs per file)
 
Micro-optimization finally paid off! I just got my WebGL implementation to work faster than Google's on my netbook!
 
Xeo
You know, it might work for the artists only, or for the producers with their work and project breakdown cheats and task histories, but it certainly won't cut it for coders and designers
who change files several hundred times per day
 
Hmmm. Running WebGL using DirectX is interesting....
 
Xeo
That sounds wrong
 
3:29 AM
I wrote an abstract renderer class so I can choose between OpenGL and DirectX for rendering.
That was very difficult to debug (the code ended up getting a bit messy)
It actually crashed Visual Studio several times
By the way; I still don't get the point of "long long" in MSVC
Long is the same size as int?
 
Xeo
It is specified as >= int
 
Never quite did understand that
 
Xeo
same with long long >= long >= int >= short >= char
something along those lines
everything could effectively be 1 byte big only IIRC
 
This is a new one --- "Illegal return statement"
 
?? int >= 16 and long >= 32, right?
 
Xeo
3:34 AM
@Pubby not specified IIRC
I could be wrong though
 
Xeo
Interesting
My chat is buggy and hopping up and down
 
It's also interesting that the standard defines "byte" as the size of a char. Not 8 bits.
 
Xeo
> 3.9.1/2 There are five standard signed integer types : “signed char”, “short int”, “int”, “long int”, and “long long int”. In this list, each type provides at least as much storage as those preceding it in the list.
No concrete values
@RichardPennington That would exclude certain embedded systems, with, say, 16bit bytes
That's what CHAR_BIT is for
char is effectively a byte
 
3:38 AM
non-8-bit bytes are incredibly silly
 
No, you misread what I said. The standard defines a byte as whatever a char is. Not as 8 bits.
 
Xeo
24
Q: System where 1 byte != 8 bit?

XeoAll the time I read sentences like don't rely on 1 byte being 8 bit in size use CHAR_BIT instead of 8 as a constant to convert between bits and bytes et cetera. What real life systems are there today, where this holds true? (I'm not sure if there are differences between C and C++ regar...

 
It is silly.
 
it's strange how a nybble is 4 bits, don't think it can be anything else
 
bits, right?
 
3:41 AM
Yeah, typo
 
By the way; is there any way to load a 32-bit .lib into a 64-bit application?
I've heard people have somehow gotten this to work through COM, but that is windows-specific
 
I decided to add code coverage support to my compiler stuff today. It turns out that I needed to implement global destructors in the runtime system. For C programs. Unexpected.
 
4:23 AM
@RichardPennington A byte is defined as the addressable unit.
Then a char is defined as a byte.
 
Xeo
@curiousguy smallest addressable unit
 
You could have 64 bits char.
@Xeo That's what I mean by "unit".
 
That's what I was trying to say.
 
If there is something smaller, it isn't the unit.
 
Then it's not a byte.
 
4:25 AM
@Pubby not for some system that doesn't address octets
C/C++ have the requirement that a byte is a least an octet.
4 bits bytes are not allowed.
Even if existing hardware deal with 4 bits units.
@Pubby yes.
@EthanSteinberg Of course.
@kfmfe04 which C part?
 
@IDWMaster you'd have to do something out-of-process AFAIK to cross-mojinate 32bit with 64bit. I don't know COM at all (thank God) but I assume it does RPC-type stuff?
@Xeo I've been toying with the idea of keeping repos in teh cloudz on Dropbox. Are you guys doing that?
 
Xeo
I get the feeling git doesn't allow you to just add a directory. Or I'm doing something wrong.
Anyways, I'm off to sleep
 
@Xeo I think that git doesn't know about directory.
You cannot put directories, only data files.
If the directory is important, maybe you should have a file to explain why it is important, in the directory.
Like 00README
 
5:06 AM
@MooingDuck I am referring to an object, not to the member of a class that was referring to this object.
int* is a pointer to object of type int, not a pointer to a member of a class of type int.
A pointer to object is different from a pointer to member.
@MooingDuck The name lookup of T::i isn't the issue here.
The issue is member access.
I am not accessing a member.
 
 
2 hours later…
7:39 AM
this is perhaps the only time in my living memory, that this chat room is not active.
where is everybody?
 
Awesome, just got two answers on a question on Science Fiction and Fantasy. One of them is about out-of-universe (i.e. real world) scientific speculation and the other is a summary of a paragraph from my question.
 

« first day (433 days earlier)      last day (4529 days later) »