« first day (431 days earlier)      last day (4531 days later) » 

Xeo
12:00 AM
5.1.2/7
> but for purposes of name lookup (3.4), determining the type and value of this (9.3.2) and transforming idexpressions referring to non-static class members into class member access expressions using (*this) (9.3.1), the compound-statement is considered in the context of the lambda-expression.
 
@MooingDuck this will refer to the closest variable (being) captured in the scope in which "the lambda expression" is found
what answers what?
 
Xeo
@refp Mooing edited it out already
 
@refp I quoted the wrong part of the standard
 
@Xeo are you saying that that quote says that you shouldn't be able to reach the "this" of the lambda itself?
if so; I don't agree at all (so I hope not).
 
Xeo
@refp yes
 
12:05 AM
maybe something gets lost in translation when, even though I usually think in english nowadays anyhow..
s,when,then,
ah nevermind, I read it completely wrong
 
@refp The part of the standard he quotes is pretty clear. The use of this in a lambda in a member function refers to the .... alright
 
Xeo
this isn't looked up in the context of the operator() of the lambda, but in the context of where the lambda-expression is.
 
yeah, I got that now, thanks
now I'll have to the something
 
Xeo
huh?
 
@Xeo What? Can't you what he said?
 
12:09 AM
TEST*
 
RESULT*
 
[this](){[this](){}();}();
meh..
I can't edit it if I write something after?
 
@refp press up twice?
 
ah, nevermind
 
@refp also, ideone.com
 
12:11 AM
no, not ideone
we are dealing with lambdas, they are inline (therefor we should write 'em here)
 
@refp wait, the heck did you write? You... captured this? Interesting...
 
the outer lambda is in the scope of a member function, does the standard guarantee that the value of this will be inherited, or can we potentially get the value of the outer lambda inside the inner lambda?
I tested this in g++, you'll get the value of the class in which we define the lambda member function, but is that guaranteed?
 
Actually the standard says you can capture identifiers, identifiers by reference, and this. Cool
 
Xeo
Yes it is, because the this from the outer lambda is looked up in the enclosing scope, and that this is found by the inner lambda during lookup
 
but the standard doesn't explicitly say that, though I know it mentions that things captured in the outer lambda will implicitly be captured by the inner lambda, but still..
 
Xeo
12:15 AM
Why not just make that a question?
 
what if the outer lambda doesn't capture this?
 
it will result in a compile error on g++
because I don't do questions! (or something, maybe I should write it as a question)
@Xeo but before I do that, just go think about it for awhile..
.. that was a small image
 
Xeo
Think about what? Which this the inner lambda captures?
 
"is considered in the context of the lambda-expression", what the heck does that mean - really?
@Xeo yes
 
Xeo
void LAMBDA_CONTEXT_HERE(){
  auto l = []{ std::cout << "I'm in a context!\n"; };
}
You could say it's the enclosing pair of curly brackets.
 
12:18 AM
@Xeo well, it's more ambiguous for nested lambdas. Are they both considereed to be in teh same context? or is one in the context of the other?
 
yes, but the context of the inner lambda should be the outer lambda, therefor this could/should point to the outer lambda?
 
Xeo
@refp And the this of the outer lambda is looked up in the context of the outer lambda, which is the member function
 
it isn't said that that this will be looked up using that method
or maybe it is, I'm just out to find something wrong
 
Xeo
It is.
 
something fun.. something to keep my from going out in the snow to buy smokes so I can get back to working all night
 
Xeo
12:22 AM
Interesting
 
I'm semi trollin'
:(
 
Xeo
struct foo{
  void bar(){
    auto l = [this]{ [this]{}(); };
  }
};
MSVC doesn't compile this
> src\main.cpp(4): error C3480: '`anonymous-namespace'::<lambda0>::__this': a lambda capture variable must be from an enclosing function scope
And Clang doesn't implement lambdas yet
And my local version of GCC doesn't too
Fuck this.
 
does it compile auto l = [this]{ []{+this;}(); };?
gcc compiles that
what you wrote
struct Obj {
void func () {
[this](){
[]() { *this; } ();
} ();
}
};

Which I beleive it should
 
Xeo
Ha, if I implicitly capture it with [=], then your code works
 
fixed font my ass..
yes, it's a bug
I guess..
 
Xeo
12:24 AM
struct foo{
  void bar(){
    auto l = [this]{ [=]{this;}(); };
  }
};
Sounds like a bug
 
you should be able to do it without [=]
 
Xeo
No
 
since it is specified that an inner lambda implicitly should inherit what ever the outer lambda brings in
 
Xeo
Because then you capture nothing
 
yes?
 
Xeo
12:25 AM
Which would be illegal
@refp Where?
 
wait what.. did I misunderstand that snippet as well
blargh, I didn't notice the comment spanned over two lines.. maybe I should go buy those smokes and get to work before I get way too tired
@Xeo but the capture of this in both outer and inner lambda is a bug in MSVC, because that I cannot have misunderstood..
:(
 
Xeo
I just found something interesting
According to the standard, this should be well-formed:
 
no, I was just about to go and buy smokes..
 
Xeo
void f(){
  int a;
  auto l = []{ [a]{ int b = a; }(); };
}
> The reaching scope of a local lambda expression is the set of enclosing scopes up to and including the innermost enclosing function and its parameters. [ Note: This reaching scope includes any intervening lambda-expressions. —end note ]
 
@Xeo +1
 
Xeo
12:30 AM
Or I misinterpreted that
 
yeah, I think you did..
there is an example of that in the standard, which they describe as an error
 
Xeo
But it doesn't seem like that
 
it looks like the inner lambda is grabbing variables from the outer lambdas context...
 
Xeo
Hm
@refp True, strange.
 
I read that example wrong which lead me to believe that [this]() { [](){+this;} ();}; was correct
@MooingDuck they are allowed to do that though, but the outer lambda needs to explicitly grab them
then the inner lambda can implicitly snatch them by using [=] or [&] IIRC
or well, the outer lambda doesn't have to do it "explicitly" it may use [=] as well
but it has to declare that it want's to snatch 'em
 
Xeo
12:34 AM
> If a lambda-expression captures an entity and that entity is not defined or captured in the immediately enclosing lambda expression or function, the program is ill-formed.
Boo.
I now understand how that wording is meant
void f(){
  int a;
  auto l = [&]{ [a]{}(); };
}
 
but we still got the [this] [this] bug, that's something atleast!
 
Xeo
the inner lambda capture can trigger the outer lambda capture
 
yeah, there is an example just like that in the standard
no
or well yes
 
Xeo
> The implicit capture of an entity by a nested lambda-expression can cause its implicit capture by the containing lambda-expression
 
but a is gonna be in the outer lambda even if the inner lambda wasn't there
 
Xeo
12:36 AM
@refp No, only if a was odr-used
 
odr-used? what does that even mean
I think you got it wrong though
 
Xeo
3.2, One Definition Rule
 
I'm very sure of it, just need to find the right quote
void func () { int a; [&](){a+=3;} ();}
of course that is allowed, are you saying that it isn't?
 
Xeo
no, I never said that
I just said that a isn't there if it isn't used in the lambda
 
it looks like you did
"but a is gonna be in the outer lambda even if the inner lambda wasn't there" you replied "No"
 
Xeo
12:39 AM
Which is correct for the example you gave
 
it's not like the inner lambda can tell the outer lambda to bring a into the outer lambda so that the inner lambda can take it from the outer lambda
 
Xeo
void f(){ int a; auto l = [&]{ /* no trace of 'a' to be seen*/ }; }
@refp It can.
 
so are you saying that g++ or MSVC is buggy?
 
Xeo
If the outer lambda does implicit captures
 
g++ allows what I wrote
 
Xeo
12:40 AM
Which code exactly?
 
Xeo
I never said that code is wrong
a is there because you use it. If you didn't use it, it wouldn't exist in the resulting closure object
 
what the what, you did?
 
Xeo
That's all I said
 
quick question, why is left recursion defined as this:
what significance is beta?
 
12:43 AM
@Xeo that's just a "stupid" way to word it though..
I got one glove on, time to go and buy those damn cigarettes..
 
@Pubby The break condition?
 
@KerrekSB what would that be?
yeah
Is there one here?:
your joke is going over my head
 
Ughs, sorry, my internet is acting up!
I got "retry"s aplenty
 
oh, thought it was a recursive joke
 
No. To read a recursive joke, read this line.
 
12:51 AM
hehe, so what's a break condition?
 
You know, when you don't recurse any more.
 
What is the one here: expr -> expr + term
Or is it the start of the recursion? :S
 
Xeo
♥
 
2 messages moved to Trash
 
whoa, my type erased iterators made it through my mini-test-suite!
of creation assignment and destruction
next I'll test doing stuff :/
 
Xeo
1:00 AM
lol
 
I use this a surprising amount when testing stuff: #define assert_exception(expr) try {expr; assert(0); } catch (...) {}
 
Xeo
oO
Ah, I see now
So you hope for failure, eh?
 
assert_exception(std::vector<char>().at(3)); //make sure it throws
yeah
of course, I don't test the STL, I test my libraries.
for instance I just noticed my type-erased iterators lets me assign a std::list::iterator to a any_iterator<std::random_access_tag... when it ought to throw an exception
 
Can't you concept check that to fail?
 
1:17 AM
@LucDanton is concept check = use static_assert?
 
@MooingDuck No.
Concept checking is as close to the concepts proposal we can get under current C++.
 
@LucDanton Is it some arcane Boost voodoo?
 
@KerrekSB It doesn't have to be.
 
@KerrekSB Just "Boost" would do.
 
Ah, arcane Boost voodoo without the good bits! :-)
SVN is terrible, by the way
 
1:19 AM
@LucDanton well the problem is it's using a constructor that should be SFINAE'd out. I'm so bad at SFINAE :(
 
I'm trying to improve this OSS game, but I can't really "commit" anything
Why can't the world run on git?
 
And for the none of you who have been following my progress, I did get the iterator wrappers down to 12 bytes from 32 by removing most of the inheritance, when someone casually suggested that I didn't need to up/downcast ever.
 
Well, all I'm casually suggesting is that you can check whether a given type supports a Random Iterator concept or not using Boost.ConceptCheck.
 
@LucDanton: Actually it does that for most cases. It's failing for the case where I take a bidirectional iterator, assign it to a any_iterator<std::bidirectional_iterator_tag..., and assign that to a any_iterator<std::random_access_tag.... It shouldn't be valid, but it's going into my template constructor from a random access iterator somehow
 
I see.
Using double dispatch?
 
1:28 AM
yes
 
Xeo
Using MSVC?
 
@Xeo yes
@Xeo you already tried to help me on this exact same issue before, and gave up or something
 
Xeo
Did I? Hmm
Mind showing that assignment code again?
 
@Xeo it's currently 1000 lines of uncommented hodgepodge, I don't think you really want to look at it :P
 
Xeo
lol, just the assignment code
 
1:38 AM
I think ideone.com/VnhJB has all the relevant code. The comment is right above the constructor that's getting called when it shouldn't
That constructor is for iterators with the same value_type, that aren't also derived from any_iterator_base
Actually, come to think of it, that first restriction is not needed, since that gets caught later. Doesn't fix the problem though.
 
Xeo
@MooingDuck Okay, and which one should be called instead?
 
The last one with the static_assert
 
Xeo
Ehm, well, you only ever compare the value types, not the categories AFAICS
So of course the called one is a better match
 
enable_if<is_same_value_type() && !is_anyiter(),... why is the !is_anyiter() getting ignored? Or is it wrong?
 
Xeo
What does the is_anyiter test have to do with that?
oh, wait
 
1:46 AM
I missed a line of code: ` typedef te::any_iterator<std::bidirectional_iterator_tag, char> any_bid;`
the RHS type is that
and stepping in verifies that as the RHS type
yeah, I've always been terrible at explaining anything
I just write code nobody understands
 
Xeo
Try a remove_reference on that iterator in the is_anyiter test
It'd be strange if you need that, because iterator should be deduced as a non-reference type, but who knows
Just throw more type traits at it, maybe it works. :P
 
#define is_anyiter() std::is_base_of<any_iterator_base<valuetype, differencetype, pointertype, referencetype>, std::remove_reference<iterator>::type>::value?
 
Xeo
Yes
 
ah, need a typename
 
Xeo
with a typename
 
1:54 AM
now it's got some other error on a line that previously compiled, I'm looking into it
oh pft, the base class has no default constructor and that last constructor doesn't construct it.
 
Xeo
heh
So it was the remove_reference?
 
now it's failing to construct from char*
 
Xeo
lol
 
wait, no...
will that static_assert fire if the class is instantiated, or the function used?
 
Xeo
Yours will always fire :)
A static_assert will need to depend on a template paramter
 
1:59 AM
no, I should remove that function altogeather. What am I doing? Why did I add it?
 
Xeo
Otherwise you're screwed
 
time for bed I think
 
Xeo
But that dependency is easy to add
 
oh, pft. I delete that one constructor and everything works perfect
thanks, remove_reference it was
 
Xeo
template<class>
struct fake : std::false_type{};
I still don't understand why that remove_reference was needed.
 
2:00 AM
blame Microsoft
 
Xeo
Because iterator should've been deduced as any_iterator<std::bidirectional_iterator_tag, char> and not some reference type
 
yeah. wierd
@Xeo: Thanks, I'm going home now!
 
@Xeo What's the signature look like? That accepts the parameter that is deduced?
 
ideone.com/VnhJB constructor #3
 
Xeo
@MooingDuck np
@LucDanton template<class iterator> blah(iterator&& it, SFINAE_MACRO(iterator))...
 
2:05 AM
@LucDanton it's also missing this line from main: typedef te::any_iterator<std::bidirectional_iterator_tag, char> any_bid;
 
What call yields a reference type?
 
@LucDanton any_rand(anybidiiter) last line
 
Xeo
any_random rnd = any_bidirectional(some_bidit);
 
Okay, you get a reference type deduced because you're using perfect-forwarding and you pass in an lvalue.
 
Xeo
No, it's an rvalue.
argh
> auto anybidiiter = any_bid(biditer);
wait
oh
 
2:07 AM
Well, which constructor call are we in?
 
Xeo
Nevermind me, you're right
 
the third one
 
Xeo
I looked at the wrong assignment the whole time
Of course you get a reference deduced
> auto i=**any_rand(anybidiiter)**
anybidiiter is an lvalue
 
@Xeo good to note. Can I go home now? :P
 
Xeo
No? :P
 
2:09 AM
@LucDanton thanks!
 
2:56 AM
17
Q: Why does compiler inlining produce slower code than manual inlining?

Johannes GererBackground The following critical loop of a piece of numerical software, written in C++, basically compares two objects by one of their members: for(int j=n;--j>0;) asd[j%16]=a.e<b.e; a and b are of class ASD: struct ASD { float e; ... }; I was investigating the effect o...

The same guy is back. And at it again... geez
 
Xeo
Heh
sure is a rep well
 
How strange - I'm valgrinding something, and I have "definitely lost" memory from "below main" in libc-start.c
 
Xeo
static stuff?
 
Would that be "definitely lost"?
That sounds more like "still reachable"
 
Xeo
static foo* pointer;
initialize to new memory somewhere, definitly lost. :P
 
3:10 AM
Static and lost? That would require work!
OK, plausible, though. Let me check
 
Xeo
Is the code big?
 
Yep. It's the UQM source, from the 3DO
 
Xeo
oh, lol
 
It's C with templates-via-macros
quite spectacular
 
Xeo
Try to make an SSCCE out of that :D
 
3:11 AM
There's a hashmap macro-template
instantiable by #defining the "template parameters"
 
Xeo
hehe
 
People in those days must have had quite a stomach
 
Xeo
#define KEY_TYPE int
#define VALUE_TYPE double
MAKE_HASHMAP();
#undef KEY_TYPE
#undef VALUE_TYPE
? :P
It's certainly very awesome for generic code generation
 
Xeo
not only in C, but also C++ where you can't quite use templates
 
3:14 AM
(We just improved that one to allow for deallocation)
 
Xeo
OOP in C is also quite strange
with manually assigning the member functions
I got the SVN repo of the eAthena source, an english Ragnarok Online emulator, and it's also completely written in C
That said, it compiled insanely fast.
for all kinds of versions
 
Ah, indeed - zero-day compilation
 
Xeo
huh?
 
It compiles in zero days. Unlike Boost
 
Xeo
heh
Boost is a bitch to compile
I'm glad I only had to use the header-only versions yet
 
3:19 AM
But it seems to be impossible to write correct code in C
 
Xeo
xDD
 
I've never seen a largeish project that doesn't leak left right and center
 
user406009
You can write C++ that compiles faster, though heavy use of "interfaces".
 
Like the Linux or NetBSD kernels?
 
user406009
But then you have the cost of virtual functions and dynamic allocation.
 
Xeo
3:21 AM
Hm, any idea how to count the total LoC# in a project?
 
This UQM thing is multithreaded and the graphics have to be deallocated asynchronously. So in some corner cases they clearly just said, meh, just leave 'em...
@Xeo clint or so?
 
Xeo
They'll get freed anyways at the end. :P
 
@RichardPennington You'd imagine that those would have to be done carefully :-)
@Xeo Right, patently
I just had to refactor a hash map because it had cross-dependence among the elements, so you simply couldn't deallocate it.
Now I split it into two. One comes first and goes last, and all is well.
But since that's sort of just static data, clearly the thinking was that it wouldn't matter.
 
Xeo
@KerrekSB I thougt more of a cool linux bash command that recursively scans directories, opens all .c and .h files, counts the lines, and reports back at the end. :P
I have the feeling bash can do that. I don't know how, though.
Also, can I somehow, in VS10, time how long all builds of a batch build take together?
 
find . -name "*.[ch]" | xargs wc
 
3:26 AM
@Xeo Minus comments, non?
Just take some static code analyzer
 
Xeo
@KerrekSB Would be nice, but not a must-have. I only want a rough estimate
 
Rather than LOC you should count statements or something...
Every macro counts as -1
 
Xeo
xD
if @RichardPennington's command does what I think it does, the eAthena source has roughly 164k LoC
 
log total. comments and all.
loc
If your compiler supports code coverage (e.g lcov/gcov) you can easily get an idea of the real number of executable statements.
 
Xeo
164k LoC, 8 projects, 2 configs (Debug, Release), roughly 4 minutes
I really like how they do command line coloring though
hm, damn fixed font not expanding to the right
ShowMessage(""CL_XXBL" ("CL_BT_YELLOW" eAthena Development Team presents "CL_XXBL")"CL_CLL""CL_NORMAL"\n");
CL_BLAH are escape sequences
 
3:49 AM
posted on December 21, 2011 by Dave Abrahams

This entry is part of a series, Having It All» In the last article in this series, I mentioned that we’ve solved the problem with polymorphic lambdas and concepts, and I promised to discuss it here. And so I am. Quick concepts review Just like type declarations, concepts would add two kinds of type-checking to [...]

 
Xeo
omgomgomg
 
This thing is more responsive than my RSS reader.
 
Xeo
I love how it just pops into the room, leaves the message, and pops out again
 
Interesting article. I like how bubbly Dave sounds in his writing sometimes.
 

« first day (431 days earlier)      last day (4531 days later) »