« first day (448 days earlier)      last day (4724 days later) » 

02:00
by the way, you were all supposed to star that
oh well
now I need to start thinking about exactly which part of my code I want to start RARGH SMASHing first
Xeo
Xeo
Oh, it didn't take that long on Comeau Online. Like 2 minutes I think
@Xeo Same for gcc 4.7*. Specs: Intel Q9550, 8GB
Xeo
Xeo
@sehe lol, power rig xD
oh by the way
Xeo
Xeo
@sehe Got a Clang installation handy?
02:02
look at my epic declarations shenanigans in the parser header
Clang++:
test.cpp:25:3: error: implicit instantiation of undefined template 'sum_from<1>::to<10000>::equals<50005000>'
  sum_from<1>::to<10000>::result();
  ^
test.cpp:18:12: note: template is declared here
    struct equals;
           ^
1 error generated.

real	0m0.629s
user	0m0.530s
sys	0m0.090s
    class NamespaceAST : public AST {
    public:
        Memory::AlwaysInitialized<StringExpression*> libname;
        Memory::AlwaysInitialized<bool> dynamic;
        Memory::AlwaysInitialized<IdentifierAST*> name;
        std::vector<Memory::AlwaysInitialized<AST*>> contents; // using atm
    };
    class NamespaceAST;
note to self: always paste the shenanigan in question
@DeadMG FTFY: use a typedef :)
What is that for?
it's obviously not for anything :P
Xeo
Xeo
02:03
@sehe Wow. And could you try GCC with to<250000> please? That should theoretically hit the default instantiation depth if I calculated it correctly
vestigial forward declaration which is now a backward declaration
Taking longer... growing memory use... hold on
@DeadMG Yeah, and that sounds retarded :)
what I found so funny about it wasn't so much that it was redundant, but that they were literally right next to each other
so obviously the last time I was in this file, I was paying absolutely zero attention to what the fuck was going on
Xeo
Xeo
lol
02:05
Running it twice because I'm too lazy to copy the timings manually and I ran it from vim
@Xeo Ok, peak memory usage was 3500mb, -O3 with gcc-snapshot on the same amchine:
/usr/lib/gcc-snapshot/bin/g++ -std=c++0x -g -O3 -march=native -I ~/custom/boost/ test.cpp -o test
test.cpp: In function 'int main()':
test.cpp:25:35: error: invalid use of incomplete type 'sum_from<1u>::to<250000u>::result'
test.cpp:18:12: error: declaration of 'sum_from<1u>::to<250000u>::result'
make: *** [test] Error 1

real 0m49.376s
user 0m46.270s
sys 0m3.090s
Does -O3 make a difference?
The funny thing was, the error message is printed quite some time before completion :) I'm assuming that the cleanup phase is taking about 5 seconds there (probably useful in case multiple .cpp's were specified)
Does GCC start optimizing before typechecking?
Xeo
Xeo
Err, where is the result itself?! D:
02:08
@RMartinhoFernandes Not that I noticed. I just thought i'd mention it
@Xeo huh. Is that a question to me?
Xeo
Xeo
Why doesn't GCC 4.7 mention equals<SOMEBIGNUMBER> :(
@sehe Yeah
@Xeo Lemmesee with 4.6.1 again?
Xeo
Xeo
But I'm surprised that the default recursive instantiation depth wasn't reached
Oh, wait
Ok, 4.6.1 reaches same memory peak usage, output:
Xeo
Xeo
My calculation was off I think. :(
02:10
g++ -std=c++0x -g -O3 -march=native -I ~/custom/boost/ test.cpp -o test
test.cpp: In function ‘int main()’:
test.cpp:25:35: error: invalid use of incomplete type ‘sum_from<1u>::to<250000u>::result’
test.cpp:18:12: error: declaration of ‘sum_from<1u>::to<250000u>::result’
make: *** [test] Error 1

real	0m40.877s
user	0m37.920s
sys	0m2.940s
@Xeo By how many orders of magnitude?
Xeo
Xeo
Graargh, GCC, Y U NO SHOW RESULT?! D:
@RMartinhoFernandes jerk
Xeo
Xeo
@RMartinhoFernandes Some 140+ it seems
Or I did that calculation wrong too
140+ orders of magnitude? Gasp
Xeo
Xeo
I'm confuzzled!
@Xeo Eternally
Xeo
Xeo
Someone tell me how to correctly calculate N to hit the default max depth of 500 with that code. :(
well what is the complexity of your instantiations?
log(n)?
Xeo
Xeo
I thought 2^500, but that is 3.27e+150, which sounds a bit much
02:13
no
I'm pretty sure GCC will hit some machine limit before it instantiates 140 orders of magnitude more levels.
Too tired. Perhaps, the exceeding of the limit counts as SFINAE <biggrin/>
Xeo
Xeo
@DeadMG Should be
if you have log(n) = 500, then n = 2^500
Xeo
Xeo
I divide the workload by 2
02:13
@RMartinhoFernandes hehe
Xeo
Xeo
and recurse from that
Atleast I hope that I actually do that
the fact that it sounds a bit much is because you have an efficient algorithm and so you need an absurdly large input to break it
Just for kicks, clang++ with 250000u
sehe@natty:/tmp$ time clang++ -O3 test.cpp
test.cpp:25:3: error: implicit instantiation of undefined template 'sum_from<1>::to<250000>::equals<1185353928>'
  sum_from<1>::to<250000>::result();
  ^
test.cpp:18:12: note: template is declared here
    struct equals;
           ^
1 error generated.

real	0m15.505s
user	0m13.880s
sys	0m1.610s
Xeo
Xeo
Nice compile time
And yay, that result is the 32bit truncated value xD
Yeah. It's taking some serious time there. I think should be upgrading to server boards :)
Xeo
Xeo
02:14
I should replace unsigned with uint64_t
does that mean that the CPU uses 0.015s, give or take, purely in context switching?
@sehe The result doesn't look right.
Xeo
Xeo
38 secs ago, by Xeo
And yay, that result is the 32bit truncated value xD
yes
the CPU uses 0.015s context switching
daaaym, that's a lot
Looks like.
It's about 0.1% of total time.
02:16
probably too many calls to mmap
Xeo
Xeo
@sehe Mind testing with uint64_t instead of unsigned? :)
@Xeo Doing that a.t.m.
Xeo
Xeo
kk
> 31250125000
Should be the result
No real difference... in timing at least. gcc 4.6.1:
g++ -std=c++0x -g -O3 -march=native -I ~/custom/boost/ test.cpp -o test
test.cpp: In function ‘int main()’:
test.cpp:27:35: error: invalid use of incomplete type ‘sum_from<1ul>::to<250000ul>::result’
test.cpp:20:12: error: declaration of ‘sum_from<1ul>::to<250000ul>::result’
make: *** [test] Error 1

real	0m41.612s
user	0m38.790s
sys	0m2.810s
it won't if you're running an x64 compiler on an x64 machine
since uint64_t will be word-size
Xeo
Xeo
02:18
No, I only want to know for the result, as it needs at least 36bits
Hmm... does delete perform a dynamic cast when given a polymorphic base pointer?
Xeo
Xeo
and clang is 32bit IIRC
@KerrekSB Err, why should it?
well, I suspect that the overhead of 64bit arithmetic emulation is limited when considering the other overheads of template instantiation
Dammit. I left out -std=c++0x for clang before. Is that bad? Running the uint64_t variation with c++0x flag now
Xeo
Xeo
It just calls the destructor and frees the memory allocated by new before
02:19
sehe@natty:/tmp$ time clang++ -O3 -std=c++0x test.cpp
test.cpp:27:3: error: implicit instantiation of undefined template 'sum_from<1>::to<250000>::equals<31250125000>'
  sum_from<1>::to<250000>::result();
  ^
test.cpp:20:12: note: template is declared here
    struct equals;
           ^
1 error generated.

real	0m15.631s
user	0m13.920s
sys	0m1.700s
Xeo
Xeo
@sehe Yep, that's the correct result!
Yay for clang maths
Xeo
Xeo
But seriously, Clang is friggin' fast.
lol, I still had goto ASTs
Xeo
Xeo
@DeadMG Burn 'em.
02:20
@DeadMG You cut goto?
yep
@Xeo I thought that was part of the point.
Ah I see. Following the example of java, of course
man, the WideC compiler is going to blow it out of the water though
he says, hopefully
@DeadMG You a tyrant! Now how will I ever write... WTF goto is for?
user406009
02:21
Doesn't matter how fast clang is. Until it gets lambda support it's not worth using on fun projects.
7
lol
nothing, really
Xeo
Xeo
@EthanSteinberg Sadly, this.
@EthanSteinberg 100% with you.
Xeo
Xeo
But it's cool for testing stuff
As long as you don't want to test lambdas
Or initializer lists
woah. that is some seriously fast accrued star-level.
Xeo
Xeo
02:22
Or inheriting constructors
lol
@Xeo GCC doesn't have that either.
Does MSVC have that?
I'm off to bed. Cya around
you know
Xeo
Xeo
lol
@RMartinhoFernandes Good joke
02:22
never mind
user406009
GCC and MSVC have lambda's last I heard.
Xeo
Xeo
@sehe Bye!
@RMartinhoFernandes Dang, that was a stinger
my sides hurt like a bitch now
So, nothing has inheriting ctors.
user406009
Lambdas are essential for using boost::asio without going crazy.
user406009
02:23
Best new C++ feature by far(just behind rvalues).
Xeo
Xeo
Lambdas are essential for the STL part without going crazy.
I seriously don't know how people managed before.
Lambdas, rvalue refs, variadic templates, list-initialization. My favourite features. Only GCC has them all.
2
Xeo
Xeo
I mean.. c'mon, structs for every little bit of shit? :|
@Xeo PS. just for completeness, this is the uint64_t version I tested with ideone.com/nwO7w
Xeo
Xeo
> g++: Internal error: Segmentation fault (program cc1plus)
lawl
02:25
I think I'm getting hooked on return { blah, blah, blah };.
I HAVE THAT
theoretically
Xeo
Xeo
@RMartinhoFernandes Doesn't allow explicit construction though, IIRC
I wonder how to make that error into a warning and still have such a nice output.
@Xeo Yeah, that's a pity.
Xeo
Xeo
Especially since warnings are compiler dependant. :(
@Xeo How would it get the correct address to pass to the deallocation function?
02:28
ooh
Xeo
Xeo
@KerrekSB Oh, good point. Maybe it just saves the address in addition to the size in front of the allocated block
maybe I can ditch that crappy, annoying AST class
@Xeo That would require knowing the address to figure out the address.
Xeo
Xeo
@RMartinhoFernandes Why? When you allocate with new, you obviously do know the address...
Oh, wait, I understand
Cut that
personally, I'd implement it so that the destructor returned the value
02:29
@Xeo But when you delete it could be a different pointer.
Xeo
Xeo
@RMartinhoFernandes Maybe save it in the derived class' vtable? hmm
so you call the destructor, virtual dispatch picks the right destructor, then it tells you where to find the initial address
@Xeo That could be a solution. I'd prefer that the dtor did the magic like the puppy suggests.
Xeo
Xeo
@RMartinhoFernandes Ha, that idea with the vtable might actually be the truth
woof woof
Xeo
Xeo
02:31
Since the vtable should contain pointer offsets for the derived classes
@Xeo It doesn't contain any
the thunks do the offsetting
I think it all works thanks to the thunks.
of course
they are what actually makes the pointer casting happen
without that the whole thing would break
I know, I was trying to make a joke.
Seems like it failed.
just seemed like a statement of fact to me
02:34
It was a play on "think", "thanks", "thunks".
would have been better with "think thank thunk"
or hell, you could have just said "think thank thunk"
too many separators
Damn, lemme change this message before it gets starred.
it's hard to make puns in your non-native language, even when that language even is the Language Of All Intelligent People Especially Our Glorious Leader DeadMG™, English
"Glorious Leader"?
I think it was Glorious
maybe it was Supreme instead
Xeo
Xeo
02:37
Beloved Leader, IIRC. "Geliebter Führer" is the German translation at least
"Dear Leader," that's it
@DeadMG So... isn't that the same as what dynamic_cast<void*> does?
Xeo
Xeo
@KerrekSB Oh right, there was dynamic_cast<void*>!
I don't think so
dynamic_cast<void*>? That workses?
Xeo
Xeo
But with a predefined value, it would be faster. dynamic_cast would need to walk the hierarchy
@RMartinhoFernandes pointer to most-derived object
Xeo
Xeo
Totally forgot about that
@Xeo Wait, you mean, least derived?
Or something.
Xeo
Xeo
@RMartinhoFernandes most-derived, as in, the actual dynamic type. The thing you created when newing
@Xeo But how does delete p; correctly deallocate the memory if you give it some random intermediate pointer to some complex virutally-inheriting object?
Yeah, right. I was thinking of everything upside-down for some reason.
02:41
Thinking in terms of the argument of operator delete()...
@KerrekSB It finds the right destructor and that provides the correct pointer?
Xeo
Xeo
@KerrekSB You have to eventually find out the most-derived object anyways to call the correct destructor and pass the correct this pointer. Might aswell save the offset somewhere accessible to delete.
@Xeo Just save the this pointer.
@RMartinhoFernandes What have destructors got to do with the deallocation function?
@Xeo Oh OK, you can save the final this pointer. Good idea.
@KerrekSB To find and call the right destructor involves finding the right address, no?
02:44
@RMartinhoFernandes Right, via the this pointer. Indeed!
Xeo
Xeo
@KerrekSB delete needs to call the correct virtual destructor. It might aswell adjust the pointer before passing it to operator delete
@Xeo Yeah, makes sense.
hello
what is the best way to get started with c++?
do you know how to program?
yes
02:49
... because if you do I'd recommend Accelerated C++ to you.
otherwise a different book would be more reasonable.
im checking it out now
other than reading a book you obviously want to play with it like in any odd programming language.
@jalf Concerning STM. Currently a write transaction involves a copy at the beginning and a copy at the end of the transaction. Wouldn't it be faster if the shared<T> object stored a pointer to a heap-allocated object? You could then clone it before the transaction and use an atomic swap to commit the transaction.
user406009
@Alley en.cppreference.com/w/cpp is also one of the best references for the standard library right now.
ok thanks. and what programs would you recommend to write it?
02:53
in most cases, you'd lose any benefit by having to heap allocate
how silly is this hack:
will textmarte work?
#define CPP_DECLARE_UNUSED( argName )   (void) argName; struct argName
?
@Alley you mean compiler? I'm using g++ and clang.
user406009
@Alley I suggest codeblocks for a starting IDE.
02:54
@Alley for editing your source you can use whatever editor you got.
your fundamental idea of swapping it in is a good one though
@AlfPSteinbach Hmm, what's the struct part for?
@DeadMG Really? Suppose you have shared<std::string>. Would the heap allocation of it be so expensive? (It's a small object.)
ok thanks, ill be back if i need help
the overhead of calling new is largely irrelevant of the size
02:55
@RMartinhoFernandes to flag any usage
Oh, is it to prevent accidental usage?
new can't be a small-object allocator, because it has to allocate any object
@AlfPSteinbach Ok, it is clever.
so in reality, I expect that the overhead of newing a std::string wouldn't be significantly different
02:55
@DeadMG Yeah, makes sense.
So ideally a shared<T> should somehow be associated with a pool<sizeof(T)>.
in general, new is pretty bad
well, I think that you're missing the point
why not just swap in at the end of the transaction anyway?
Neat, cppreference.com has downloadable archives.
@AlfPSteinbach wouldn't you just omit the argument name in the parameter list of the definition if you aren't using it?
a regular swap for almost all types is virtually as good as a pointer swap
@RMartinhoFernandes hm, so i can't really expect readers of my winapi lessons blog to understand it w/o explanation :-(
@DietmarKühl no not necessarily. it's good to see what it is about
02:57
Usually, for arguments, I just don't write the name, or write the name in a inline comment.
btw. great to see you here! :-)
@DeadMG I guess this holds for std::string and std::vector. I'm not sure about PODs.
void f(int /*thingy*/);
yeah
since you can just omit the name, there's little point
@AlfPSteinbach well, you can leave the name in the declaration...
02:58
@StackedCrooked You would need one hell of a large POD to justify new
You might need a pod to carry an elephant. Elephants are bigger than the moon.
@DeadMG But the swap would require a lock I assume. I don't think it'd be thread-safe.
copying it atm isn't thread-safe either
so I assume that write transactions already have protection in place
user406009
@DeadMG How would you implement something like a tree without new?
@EthanSteinberg How on earth is that relevant?
we're not implementing a tree
we're dealing with one single object
03:00
@DeadMG are you discussing the new STM stuff in gcc?
no, jalf's own STM lib
oh, I see.
@DeadMG I haven't studied the implementation yet, but I noticed that shared<T> actually has two T members. The one that is being overwritten during the commit becomes the active one after the commit.
yes, that's how I'd implement it, along with an SR/W lock
although I don't know how I'd avoid deadlocks
Deadlocks are for wusses.
03:07
I'd probably just keep like, std::vector<shared_base*> and always acquire them in the order given in the vector
Real men eat their locks alive.
@DeadMG Add a lock for acquiring locks!
rofl
C arrays suck, but it's really annoying to have to include a header just to get four characters out of a file.
@RMartinhoFernandes ?
How does including a header allow you to get four characters out of a file?
@StackedCrooked To get std::array<char, 4>.
03:11
#include <get_four_characters>
Or std::string.
I'm really just going to stick with char magic[4] for this.
I don't mind stack-allocated arrays so much.
I generally avoid them but I wouldn't jump through hoops for that.
But what I'd like was to not have to jump through hoops to get std::array.
But I'm speaking from C++03 perspective. Perhaps that will change when C++11 becomes common.
Adding an include is not something I'd consider jumping through hoops.
It pollutes!
Think of the planet, and the children!
03:15
Everything pollutes.
int a; // also pollutes!
But int a; only adds the symbol a.
And it adds it locally.
#include <array> adds stuff to the global namespace.
It pollutes locally.
@RMartinhoFernandes Use C-style arrays then..
I'd like a compiler that would use magical headers that don't add stuff to scope that are not supposed to be.
Good evening friends.
I can never know when I'm missing an #include because some other header already included something.
@Twinborn Hi.
03:20
I always include all headers that are needed in the current file without counting on it that some of those headers may already have been included implicitly. I also order my includes in descending order of abstraction level. First the application level includes, then my library includes, then boost includes, then C++ includes. This avoids hidden dependencies.
@StackedCrooked agreed but we need modules
@RMartinhoFernandes - yeah - I wish there were a tool to remove spurious headers/reorder them for minimal inclusions - have had this need since the beginning of C
@StackedCrooked I try to do that too, but if you forget something the compiler may not warn you because <array> already included <stddef.h>, and then one day you remove <array> and the size_ts in your code are now broken.
@AlfPSteinbach Agreed and I also need a haircut.
@RMartinhoFernandes Yes, it's hard to get it perfectly right.
03:21
@StackedCrooked don't we all.
@AlfPSteinbach Yes, we do.
at one time, an ex-coworker wrote a brute-force permutations (not extensive) of headers program which tried to minimize header inclusions - just try various combinations and and attempt a compile
@AlfPSteinbach I don't need one. I got one yesterday.
Mine is 16 months ago.
at one time, an ex-coworker wrote a brute-force permutations (not extensive) of headers program which tried to minimize header inclusions - just try various combinations and attempt a compile
03:23
at one time, an ex-coworker wrote a brute-force permutations (not extensive) of headers program which tried to minimize header inclusions - just try various combinations and attempt a compile
What happened here.
bizarre bug
@kfmfe04 Yeah but that increases reliance on implicit includes. Which leads to non-self-sufficient headers.
Headers that can't produce enough food for their own survival.
I accidentally hit last-page in Chrome during an edit - when I came back to the page and hit send... ...bizarro
03:24
Yeah, chat is buggy.
i think what's maybe missing is tool support for the concept of "a build"
@StackedCrooked - you're right - it assumed that there was proper feeding/maintenance of individual headers
it could treat any header as the same within a build
like precompiled
Modules.
Fucking modules.
with the rule that that no new preprocessor symbols that affect any header are introduced during a build
03:26
as old as time - I wonder if no one has attempted to propose a Module extension to the standard
daveed did
@kfmfe04 Yes, there was one.
but it was not finished
Maybe for C++17.
glacial C++ speed
nice
@RMartinhoFernandes More like C++30.
I think what annoys me the most is the crappy separation between interface and implementation that headers provide.
@StackedCrooked Great, now you crashed Flash. It can't even handle plinking?
@RMartinhoFernandes - agreed, but that one's probably much harder to rectify
You have to write part of the the implementation on the header.
03:29
What did I do?
@StackedCrooked You plinked me.
And Flash went belly up.
Not surprising.
What OS are you on?
also
I have mathematically proved that you all suck!
Talking about Flash, I've found that 90% of the time my mbp is overheating, it's due to some background Flash process in Chrome
@StackedCrooked Windows.
03:31
Is flash so unstable?
Don't tell me Flash works fine on some other platform. Flash sucks everywhere.
Flash is cross-platform. It doesn't work equally well on Linux, Windows and OSX.
It seems to work ok on OSX, but runs hot on laptops
Usually Windows is better.
@StackedCrooked I think I only use it for YouTube and plinks. It never crashed on plinks before, but it regularly barfs on YouTube.
03:32
different syntax in revision 5 (the above was revision 1)
Youtube is very annoying. Clicking the pause button followed by clicking the play button often stops the video irreparably.
I hope that n1736 makes it into the next standard - it looks like nothing but benefits
(well, maybe slight payment in compile speed, but would be worth it)
Modules? Yeah, riiiiiiiiiiiiiiiiiiiiiiiight.
@kfmfe04 Link n1736?
03:34
@DeadMG Alf's link above.
n2316.pdf
It's a more recent revision.
@CatPlusPlus - you mean bad idea or you don't think it'll ever make it in
Maybe in C++17.
@kfmfe04 It will never make it.
03:35
@CatPlusPlus ouch
It'll be a celebration if concepts ever will.
oh ok
politics? too difficult to implement? too many other features in the queue?
it's C++
what more needs to be said?
03:37
Maybe in C++17.
Maybe if I say that enough times it will become true.
rofl
man, I have nice warm fuzzy woolen socks
it's the roxxor boxxor
Nap time.
amagad dexter
Isn't that like, over for now?
03:46
yeah
that's the bad part
I want to see what happens next!! amagad :(
@DeadMG - haven't heard of Dexter - worth plowing through seasons 1-5? (won't do 6 until it's done... ...don't like the waiting, esp if it's a good series)
it's done now
ah - cliffhanger for season 7? ic
yes
I won't spoil it but it's so arrrrgh
But I will: something happens to someone.
03:58
hehe - I've been watching Breaking Bad lately (excellent series, btw) - I think one more season to go in that one
brb - switching machines

« first day (448 days earlier)      last day (4724 days later) »