« first day (557 days earlier)      last day (4406 days later) » 

8:03 AM
@FredOverflow "Can't you just go outside and play hockey like any other kid?" Epic.
 
@RMartinhoFernandes why do you start every comment with a !, is there any special reasoning behind it?
 
I do?
Oh, in code.
 
@Mysticial Oh yeah, my issues when writing my allocator wasn't with Standard Library conformance, it just happens that the compiler dies.
 
It's for Doxygen. I might setup some docs in the future...
 
@LucDanton lol
 
8:07 AM
@RMartinhoFernandes ah ok, sounds reasonable
 
@Mysticial I always try to wait a few days before accepting, just to give people time to answer, and then I tend to forget all about it until much later ;)
 
@jalf No worries. It doesn't matter anyways - even for those who play the repcap every day.
If there's one answer I want accepted badly, it's this one:
32
A: Why does GCC generate such radically different assembly for nearly the same C code?

MysticialUpdated to sync with the OP's edit By tinkering with the code, I've managed to see how GCC optimizes the first case. Before we can understand why they are so different, first we must understand how GCC optimizes fast_trunc_one(). Believe it or not, fast_trunc_one() is being optimized to this: ...

If it gets accepted before the month ends, it'll make it onto the StackMonthly.
It might make it. 33 votes on the question might not be enough.
 
@RMartinhoFernandes Hi! Out of curiosity, have you implemented std::align?
 
No. I didn't realize it was missing.
 
PHP sucks.
There, done.
 
ugh, PHP
that's the only thing I will say
 
> Do you (or your development team) use any of the following? (...) Version control (...):
lol
That's like asking a carpenter if he uses hammers.
 
@RMartinhoFernandes But they are asking PHP developers
in PHP, Jan 17 at 9:51, by edorian
@Gordon That ZEND survey is quite broken isn't it?
 
I'm not sure if you can call someone that writes PHP a "developer"
 
8:28 AM
@RMartinhoFernandes You're not the first to notice the flimsy ness of some of the questions:
in PHP, Jan 17 at 9:54, by edorian
That has pretty much the same use than saying "I expect to work with a keyboard"
Perhaps they should ask "Do you expect to use a hammer?" (potential answers: (a) all the time (b) only when I see a nail (c) when I'm out of time (d) never)
 
Aren't the first two the same?
 
You can't rule out the possibility of a PHP convict accidentally catching a glimpse of real life
 
Are you comparing PHP to what?
 
@SteakOverflow Lol at username. I'm not comparing anything.
 
Hmm, steak.
@SteakOverflow In a strange twist of fate, for once we're not bashing the PHP (yet). We're just bashing the stupid questions they put up.
 
8:34 AM
Oh.. I just read "PHP sucks", "I'm not sure if you can call someone that writes PHP a "developer""...
 
They = Zend Survey
 
@SteakOverflow Oh, that's punctuation.
 
I remember Robert Harvey mentioning that there are two tags that frequency produce ridiculously long comments threads: C++ and PHP
 
Yeah; that is.
 
C++ ones are all from pedantic details
PHP are all flamewars.
 
8:35 AM
@SteakOverflow Someone's brain might unvoluntarily have made a subconscious association of 'PHP' with 'developer'. You know how the brain works... There was no rational link of course
 
Are you a PHP developer?
I mean no offense..
indeed
 
@SteakOverflow I have used PHP. But I wouldn't call it developing. I'd call it: configuring (tweaking Joomla plugins, a bit of ampache)
 
Well.. your answer explains a lot.
I just wonder how languages like PHP and C++, with totally different goals, could be compared.
 
8:39 AM
With operator<.
 
So from your point of view, the world of PHP is Joomla and "ampache"?
 
Specialize std::less<>
@SteakOverflow Who said that? Of course not. It's just what I 'used it' for.
 
Mmh I'm computing the needed padding if pointer p is not aligned for value alignment. alignment - begin % alignment (where begin is the value of p) works but needlessly add alignment bytes if p is already aligned. What's the sane way to express what I want? (alignment - begin % alignment) % alignment doesn't seem like the best.
 
interesting.
 
@LucDanton I usually do it with bitwise ops.
 
8:42 AM
Ok, I just think it is not correct to compare them. I am a C++ developer now and I've been in PHP as well for years. I can assure it doesn't suck if THE DEVELOPER doesn't suck.
 
> You may not use Zurker if you're not yet 18. You should be playing outside, anyway, instead of spending all day in front of the computer.
^ Fuck them!
damn. >:(
 
@SteakOverflow That's always the case
 
(x & ~(alignment-1)) + alignment
 
Mar 25 at 19:58, by sehe
@ScottW I've used VB6 extensively. It's a rotten tool, but so were most competing tools. Just happy to be using better tools now, but I'm still quite convinced I used to build software about as well in VB6 as many would have using Java C#
 
@RMartinhoFernandes Oh ya, begin - begin % alignment + alignment, thanks.
 
8:43 AM
Ok, thanks for the chat. Gotta back to work!!
 
@LucDanton Oh, that's a branch of an if, btw.
 
@SteakOverflow Cheers
 
@RMartinhoFernandes Wait, so that's for checking if x is aligned or something?
 
x & alignment checks for misalignment.
No wait, not that.
Damn, lemme check the code from my classes.
 
Your computation still adds alignment if x is already aligned, so I think it's the same as my first attempt.
 
8:46 AM
inline u32 align(u32 n, u32 alignment) {
    if(n & (alignment-1)) {
        return (n + alignment) & ~(alignment-1);
    } else {
        return n;
    }
}
 
I suppose I could go with begin % alignment ? alignment - begin % alignment : 0
 
Xeo
I think you need paren there, though
 
What for?
 
Xeo
condition
got lower presc than % IIRC
 
Nonsense.
 
Xeo
8:50 AM
Or I misunderstood the code
 
(base + (align-1)) % align
 
@Xeo begin % (alignment ? alignment - begin % alignment : 0) would divide by zero.
 
@Xeo No you're right. I put them regardless. I don't know how it's supposed to go.
 
should give you the lowest well-aligned address that's >= base
 
@jalf Thank you.
 
Xeo
8:51 AM
@RMartinhoFernandes I meant (begin % alignment)? ...
 
Arithmetic be hard, durr.
 
Xeo
Precedence be hard, durr.
 
@Xeo In that case, no. Conditional has very low precedence.
 
Xeo
And I was wrong, without parens is fine too
@RMartinhoFernandes Yeah, I mixed something up
 
Assignment perhaps? Have you used %= recently?
 
8:53 AM
I think only assignment and commas are lower.
 
Xeo
It was the other way around, when you wanted to use ?: in streaming you have to enclose it in parens like cout << (foo? bar : baz), else you get (cout << foo)? bar : baz
@RMartinhoFernandes Assignment, comma and throw :)
 
Shut up, that's a statement :P
 
Xeo
Pff
Not sure if serious
 
in my code, I have to fit objects into a stack-like buffer, and I found it was easier to fill it "backwards", starting from the highest address. Then if end is the address of the last object allocated (or one past the end of the buffer if it's empty), then I could find a well-aligned address for a new object just with (end - obj_size) & ~(align-1). Basically just zeroing out the lower bits
 
Mmh, does it make sense that when my arena needs to allocate n items of type T it aligns the buffer to T, and not T[n]?
 
8:56 AM
The alignment of T and T[n] is the same.
 
Always?
 
Unless it's an extended alignment perhaps?
That's what I needed to know, thanks.
 
Xeo
@LucDanton Even with extended, it stays the same, since every element of the array needs it
 
@Xeo Aligning to T[n] doesn't prevent that.
 
8:58 AM
ah, if you just need to allocate objects of the same type, just make sure the starting address of the buffer is well aligned. Then you just have to increment by sizeof(T) for each object
 
Xeo
Sure, but it'd be quite wasteful, wouldn't it?
 
@Xeo Well yeah but if the Standard required that, what would I do about it?
 
@Xeo Why would it be wasteful?
 
Xeo
I shouldn't indulge in C++ directly after waking up, I clearly don't know what I'm talking about
 
If all the objects have type T, then you'd basically be mimicking a plain T[n]. No padding necessary between elements
 
9:00 AM
@LucDanton [ Note: every over-aligned type is or contains a class type to which extended alignment applies (possibly through a non-static data member). — end note ]
 
just align the buffer's starting address
 
Xeo
@jalf Aligning on n * align boundaries rather than align boundaries?
1 min ago, by Xeo
I shouldn't indulge in C++ directly after waking up, I clearly don't know what I'm talking about
And I even just said that, didn't I?
AFK, waking up.
 
@jalf The weirdness of rebind regarding allocators makes sure that the arena has to deal with any type (although requests can come with multiple items, hence the 'n items of type T' above). In practice though only one type will be used, and the weirdness makes sense when taking into account e.g. std::list which won't allocate T's` outright.
 
In general you can't align at n * align boundaries.
Alignments are powers of two by definition.
 
@RMartinhoFernandes but address n * align will still be aligned on a align boundary, which i think is what was meant
 
9:02 AM
@jalf Sure, I was replying to @Xeo.
 
@RMartinhoFernandes While I'm not surprised that the resulting array is also over-aligned the question if whether the alignment is still that of the element type. But nevermind those types.
 
@LucDanton yeah, but if your allocator is only actually going to be used in the simpler case, you don't have to worry about an optimal implementation of other cases. Other types could just be delegated to malloc or something, even
 
@LucDanton The alignment of compound types is defined, except in the case of over-aligned types.
Since arrays are not class types, they can't be over-aligned, and thus that property is reliable.
 
@jalf What do you mean, optimal? I'm going for basic correctness here.
@RMartinhoFernandes Wut? "is or contains a class type". Doesn't an array of class type qualify?
 
@LucDanton I mean that your allocator only really has to fit objects into your arena/pool if the type is some fixed predetermined value: the one that you intend to put into the pool. Yes, the allocator can be rebound for other types, and then it can just fall back to allocating with malloc or something
 
9:05 AM
@jalf Yes, but I can't know that type in advance. It depends on what container is used.
 
oh, it has to work with things like std::list too?
 
Otherwise it's not quite an allocator (meaning the Standard concept).
 
ok, scratch that: it has to use your arena when used in a std::list too?
 
I hate not being 18+. :(
 
@jalf The previous question was well-formed and the answer is the same: yes.
 
9:07 AM
Anyway, another option: define something like `T* get_arena() { static T buffer[big_number]; return buffer; }
 
Which means that the allocator is a template but the arena doesn't have to be.
 
then have the allocator call get_arena<T> for whatever T is. Then it uses a separatepool for each type?
 
That'd be a C++03-style allocator though, i.e. that works on the type-level.
I'm trying a C++11-style allocator on the object level.
 
sure, you can do better still in C++11
point is that it doesn't have to use the same arena when rebound for a different type
and so you can avoid the complexity of handling differently aligned objects in the same arena
 
Agreed. But it's not convenient for the user to prepare one in advance and for the allocator to find it.
 
9:10 AM
as long as you can ensure a single alignment for all objects in an arena, you save all the alignment headaches, speeding up your code (and simplifying it quite a bit too)
 
(On the other hand with this design it's inconvenient for the user to find the exact memory that he or she needs for N items if using something else than e.g. std::vector.)
 
Wait, you're saying you're allowing any type in the same arena?
 
Admittedly though this is designed for std::vector strictly.
@RMartinhoFernandes It's a consequence of the allocator requirements.
 
Won't that lead quickly to a malloc-like implementation?
 
If you share an arena with several containers, yes. And no, because deallocate is dumb (and allocate doesn't do bookkeeping). But that's not the preferred use case.
Preferred use case is arena a; std::vector<T, arena_allocator<T>> v(a); /* use v */
So in practice only one type will ever be active in an arena but allocator requirements being what they are well there I am.
 
9:14 AM
Can you give an (even if not practical) example of the case that leads to the sharing?
 
The user has to be explicit about it. So put two containers using the same arena. Otherwise, it works fine.
 
@LucDanton so you get all the complexity (both in terms of performance and maintainability) of malloc, even when it's not necessary? ;)
 
A good programmer is someone who looks both ways before crossing a one-way street. ~ Doug Linder <-- is this a pun on error checking?
 
@jalf Nope. As I said, no bookkeeping.
 
How can it work without bookkeeping?
 
9:16 AM
are we starting a library?
 
Why not? The code has to keep track of the objects, and it doesn't know if they're all the same type/size/alignment or not, even though they typically are
can't see how you can avoid the bookkeeping
 
@IntermediateHacker That's certainly not a pun.
 
Current pointer into the arena is not bumped back when deallocating unless it happens to be the last allocation. So stack-like.
 
tvtropes is awesome
 
Really if you want this to make sense we should start from the beginning, shouldn't we? I.e. what prompted me to attempt that in the first place.
 
9:23 AM
It all began when....
 
Well, std::vector<T> and std::array<T, N> are only superficially similar right?
std::vector<T> also manages elements, so it's not that painful to use with a type that's not e.g. default constructible.
 
Xeo
My meal right now is like an evil dungeon. I may find eggs within the mashed potatoes (yay), or spinache (nay...).
Good thing for me, the eggs are currently vastly outnumbering the spinach
The speed at which I eat them tells me that this state won't last very long, though....
 
But suppose you know you need to hold N (known at compile-time) elements, but you can't have all of them when constructing the container, and it's not default constructible.
 
Xeo
optional?
 
One obvious option is to use std::array<optional<T>, N> indeed.
 
Xeo
9:26 AM
Another would be to just use vector, even if the number is known
 
But there's not reason that std::vector<T, some_clever_allocator> wouldn't work.
And C++11-style allocators makes that more convenient, too.
So I'm just exploring std::vector as an interface over an arena rather than as a stand-alone container.
Other usages include fun with alloca.
 
Xeo
"fun"
 
So things that look error-prone and low-level and C-ish, but I think an arena+allocator tandem can make that look easy. And modern and sexy.
 
Xeo
"F stands for fire, that I want to burn alloca with, U stands for unforgivable! N stands for "Never I will use that!", ..."
 
I don't think it is possible to safely wrap alloca in an allocator
 
Xeo
9:29 AM
It's impossible to even wrap it unsafely, IIRC
 
@jalf The key is the arena+allocator combo. Not allocator alone.
 
since you don't really own the allocated memory. How do you implement swap , for example?
 
Xeo
since you can't pass the allocated stack space anywhere.
 
If you rely on allocators alone you end up in C++03 land, where allocators are boring.
@jalf An std::vector never owns the allocated memory, it borrows it from the allocator in an exception-safe way.
(But yeah it's more convenient to phrase the latter as 'it owns the memory.)
Point is, the relation between an std::vector and its allocator is really interesting.
 
But in C++11 it sounds like they force you to make them crappy.
 
9:30 AM
Really, an std::vector is a convenient interface to create and destroy objects on that memory.
 
Xeo
It has to make sure to call the "get rid of me" function, which I translate as "it owns the memory"
 
@LucDanton and again, how does this allow you to implement something like swap with the required semantics?
 
@jalf Swap the two allocators.
In C++11 the allocators can travel with their containers now. Can't work without that.
 
@LucDanton also, I disagree. "borrow" seems to imply that the allocator can just decide to take back the memory at any time. That wouldn't make a valid vector
 
It doesn't imply that to me.
 
9:32 AM
@Mysticial template <typename It> void foo(It A,It B,It C,It D,size_t L); ?
 
@LucDanton doesn't really solve the problem. Now you'd have the second vector's internally memory tied to a different scope, with a different lifetime
 
@sehe I'm actually doing very similar. But with a macro instead of a template.
 
so when vector A goes out of scope, vector B's memory is reclaimed
 
Xeo
@sehe "I'll make it a template, just to save myself typing since I can make the name shorter!"
 
Wait, what?
 
9:33 AM
@Xeo Indeed. Also, no need to assume the type of vector. As long as the result of *(It()) is 'compatible' enough with the implementation of that function
 
Xeo
Now if only we already had auto as "I don't care for a name" type parameter..
 
@jalf Not true.
 
Are you looking for polymorphic lambdas again? Or just Python or Haskell?
 
Xeo
The logic of polymorphic lambdas applied to normal functions
void foo(auto x);
same as template<class __unnamed1234> void foo(__unnamed1234 x);
 
Not widely applicable.
 
Xeo
9:36 AM
If you really don't care for the template parameter name
 
void foo(auto x, auto y) // same or different type?
 
Xeo
different
or rather, depends on what's passed in, I guess
 
What the hell are you talking about? — Chuck Norris 13 secs ago
 
Xeo
"Same" would work with void foo(auto x, decltype(x) y) if I'm thinking correctly
 
9:37 AM
@Xeo That's getting into "way too much complexity for no more power" territory.
 
@Xeo how would this overload be selected over/after a regular template?
 
Xeo
Pff
 
@RMartinhoFernandes Quite, reseat that reference to his latest message.
 
If only there was a language that had most of C++'s features but was not compatible with any standard or subset of C.
 
Xeo
@rubenvb That's why I appended "if I'm thinking correctly". I'm still not quite awake, so I don't know.
 
9:37 AM
@Xeo Dave Abrahams wrote on this in Pythy Syntax for C++
His article talks mostly about lambdas but some of the discussion includes (free) functions
 
@LucDanton why not? The problem with alloca is that its lifetime is determined when you call alloca. It appends to the current stack frame, and so, when you leave that stack frame, the memory is reclaimed. And so, if you swap that memory into a vector with a longer lifetime, that vector will, when you leave the current stack frame, have its internal array deleted
leaving the array in an invalid state
 
Has alloca been standardized yet?
 
@jalf The lifetime (if we can call it that) of the memory an std::vector deals with is not tied to the vector itself. I think you'll agree that creating an object of type std::vector<T> doesn't create the free store, and that the free store still exists after such object has expired.
The std::vector does inform the allocator that it's done with it, yes.
 
@sehe I have a (pretty stupid, yet working) C++ solution to the generic pythony min function. #define min(x, y) x < y ? x : y
 
9:42 AM
@jalf Same happens with any other kind of local allocator. It's not about alloca.
 
@IntermediateHacker That's about the worst you can actually do. Not even mentioning general evilness of macros (especially by that name)
 
@IntermediateHacker Really? Working?
Hint: it's not working.
 
By that same token an allocator doesn't outlive the memory it deal with. (Since they're members of the containers.)
So in other words, the allocators you're thinking of are flawed, and I'm not using one like that.
 
template <typename T> T& min(T& a, T&b) { return (a<b)?a:b; }
 
Similarly std::vector is movable. An std::vector really can't own the memory it deals with.
 
9:44 AM
damn, looking at cool generic python code is making coding in C++ look like a waste of time
 
@IntermediateHacker Go! Waste computer time instead of developer time. It's ok!
 
(Of course when using an arena+allocator moving an std::vector out of the scope where the arena is leads to bad things happening. No surprises here.)
 
Why don't I try Python again? NO!! Must. Not . Give In. To The Dark Side...
 
59 secs ago, by sehe
@IntermediateHacker Go! Waste computer time instead of developer time. It's ok!
 
@RMartinhoFernandes but is that legal to do? Doesn't vector guarantee that its memory will stay valid throughout its lifetime? Can you write a local allocator (whether with alloca or any other mechanism) which actually follows the standard?
@LucDanton and I'd argue that an implementation in which the free store suddenly vanished during a vector's lifetime would render the vector implementation noncompliant ;)
 
9:46 AM
I'm sorry, but why isn't this working?
http://pastebin.com/XaH80PwY
 
@jalf No, not really. It's the allocator that is in charge of that.
 
@jalf I just did!
 
@LucDanton that's what I'm questioning. Does it follow the standard, when a consequence of it is that the vector might suddenly find its internal array deleted?
I'm aware that such code can be written. ;)
 
The allocator requirements are not based on the container requirements, so that doesn't really come into play.
 
@ManofOneWay Looks like an issue with your system. Can't really say what.
 
9:49 AM
@LucDanton so you can write a valid and well-defined iterator which creates a valid and well-defined vector, on which perfectly valid and well-defined operations will lead to undefined behavior?
 
@jalf Come to think of it, maybe I am required to raise an error if the backing arena is dead.
 
@ManofOneWay What's that weird mole-bear-mouse-badger-stuffed gorilla-moose-bug-cow-cockroach-mutant thing in your gravatar?
 
@LucDanton and you can't, because the vector specifies which operations may throw exceptions. :)
 
@RMartinhoFernandes It drives me crazy, if I define the constructor in the .hpp file, everything is good
 
@jalf ? No, the allocator requirements do as well.
 
9:51 AM
@IntermediateHacker It's a happy hamster
 
@LucDanton do what?
 
An allocator is free to throw std::bad_alloc whenever it feels like when calling allocate.
 
@ManofOneWay oh.
 
@LucDanton sure, that's fine. But what if allocate is not being called?
 
@ManofOneWay Oh, you're not building Terminal.o.
 
9:52 AM
@IntermediateHacker (Re: Zurker) "A social network with owners, not users" - blargh that is upside down. Should be "with users, not owners" to be any kind of interesting in my book.
 
the case I'm wondering about is when you already called allocate, got your memory, and while you're using it, the allocator decides to free the memory
 
@jalf I don't care. I fulfil the allocator requirements (modulo that point).
The answer is yes, I can fulfil all Standard requirements and still fall into UB.
 
@jalf You get self-inflicted UB.
Nothing new, really.
 
@IntermediateHacker (Re: Zurker) Also, already it is secretive from the start. So, who's controlling this beta they speak of? Presumably, those users that can't get in? You know, those users who supposedly are owners? Some users owners are more owners than others.
 
@RMartinhoFernandes well, no. Normally you get UB when you do something undefined. If I use the vector in the ways that the standard guarantees should work, then I'm pretty sure I shouldn't get any UB
 
9:54 AM
My goal is to make something conformant and usable. Not ward against Machiavelli.
 
@LucDanton I don't think it's machiavelli. std::swap between vectors with different lifetimes is pretty widely used
 
@LucDanton That Machiavelli reference feels so clunky to me. Also, it seems to imply that Machiavelli was a crook. Was he?
 
He wrote The Prince.
 
@sehe It doesn't imply that and he wasn't (or at least that's the historical evidence -- maybe he wanted us to think that!).
 
argh, I really need to bring a copy of the C++ standard to work. Driving me mad that I can't look up the allocator stuff
 
9:56 AM
@jalf That's like saying that swapping std::vector<T> should swap the free-store :/
 
@LucDanton Why do we then say "ward against Machiavelli"?
 
@LucDanton I don't see how.
 
Allocator-using containers don't own the memory they work with.
 
The free store is guaranteed to outlive the vector, so it doesn't matter that the vectors have different lifetimes, because in both cases, their allocator ensures their memory will be available long enough
 
swap for containers will swap allocators and the elements they have. That's it.
 
9:57 AM
@LucDanton and it will result in containers in a valid well-defined state
 
Yeah sure, one where they have their allocators and elements swapped.
Doesn't ward against any and all UB ever after.
 
@jalf Their state only stops being well-defined once the memory dies. The swap postconditions are not broken.
 
@LucDanton but a vector which is in a well-defined state does not degrade to an undefined state without being modified
 
Plainly untrue.
 
Oh?
 
9:59 AM
std::vector<int*> v; { int i; v.push_back(&i); /* v is fine */ } /* oops */
What operation happened?
Mmh. Might not work actually.
int* is trivially destructible.
 
To be fair, the state is still well-defined. It contains a pointer that can't be dereferenced, but the vector is fine.
 
Change to a type that's not trivially destructible though and you get UB at destruction time.
 
we're still talking about allocators?
 
@RMartinhoFernandes Element destructor will touch dead stuff.
std::vector<T> v; { int i; v.push_back({ &i }); }
 
10:02 AM
Ok.
 
Could have ~T() do std::cout << ref or something.
No operation on v, yet we land into UB-land, correct?
Is the example convincing?
 
@LucDanton but that's not the vector being invalidated. That's the data you push into it being messed with
that has nothing to do with it
anyway, lunch time
 
@jalf The allocator is part of the vector state too.
 
Well sure. In the other case it's not the vector or its allocator being invalidated. It's the arena.
 
@RMartinhoFernandes Thanks man!
 
10:05 AM
Oh that's not true. The allocator is affected (in my case).
Well, in this case it the allocator you passed it that was messed with.
 
The point is, a vector doesn't encapsulate its state well enough to prevent it entering a state where it invariably leads to UB.
 
Should you still use #ifndef , #define and #endif in your .hpp object files in C++11?
 
Yes.
Nothing changed in that aspect.
 
#pragma once looks nice, but a lot of compilers seem to choke on it
 
Really? Which ones?
 
10:10 AM
I think gcc was... but actually, I think I was doing something else wrong
 
GCC supports it.
 
Any reason why in-class friend functions aren't working with namespaces?
If I move them out of class they work fine.
 
Xeo
@Pubby what do you mean "with namespaces"?
 
your probably not putting things in the right namespace
 
@Xeo The class is in a namespace and so is the friend function
 
10:11 AM
You mean friend void ns::f();?
 
Xeo
No it isn't until a declaration is provided
 
namespace foo {
  class bar {
    friend void qux() { }
  };
}
That's what I mean
 
Xeo
namespace ns{ class X{ friend void foo(X&); }; } int main(){ ns::X x; ns::foo(x); } will never work
 
@Xeo Why not? :S
 
Xeo
@Pubby qux will only be found by ADL
Because the standard says so
 
10:13 AM
Why isn't
class Terminal
{
...
std::thread m_thread = std::bind(&Terminal::go, this);
...
};

allowed in C++11?
 
@thecoshman "However, with the 3.4 release of GCC, the #pragma once handling code was fixed to behave correctly with symbolic and hard links. The feature was "un-deprecated" and the warning removed."
 
pragma once is just as efficient as classic header guards
 
@Xeo Any way to work around?
 
Seems what you were doing wrong was using GCC 3.4.
 
Xeo
Make a declaration in the enclosing namespace
Or just rely on ADL
 
10:13 AM
@ManofOneWay Constructor is explicit.
 
Ok
 
@RMartinhoFernandes no, I was just messing up static data
 
@ManofOneWay Use std::thread m_thread { std::bind(&Terminal::go, this); };
 
Xeo
@RMartinhoFernandes Inside a class? I don't think so.
Not as an in-class initializer
 
@Xeo Why not?
 
Xeo
10:15 AM
Oh, is it braced-or-equal and not only = ?
 
Xeo
Alright then
I'd probably still use = {...} just for the looks
 
= {...} generates an error in this case
 
@Xeo What's not allowed is std::thread m_thread(std::bind(&Terminal::go, this));.
 
Xeo
@ManofOneWay Which compiler were you using again?
 
10:18 AM
@Xeo Doesn't work for an explicit ctor.
 
Xeo
@LucDanton Right-y
 
gcc 4.7
 
Xeo
@RMartinhoFernandes Huh? Wasn't = {} and {} explicitly made to be the same? :s
 
Xeo
Gnah
 
10:19 AM
And that's why only unary constructors should be made explicit (unless you want the implicit conversion for those). It's mad.
 
Xeo
Screw what I say today, I'm not in shape. :|
 
@LucDanton I'm putting that as my #1 peeve with C++11.
 
What's the safest way of reading a line in C++11?
 
Okey
I can't find any good documentation on C++11, I've been using this one for now en.cppreference.com/w/cpp
 
10:21 AM
that one is actually very good
 
I think that's a pretty decent reference.
With it having the goal of being a reference, you obviously can't treat it as a tutorial, though.
2
 
the examples help me quite a lot though as a beginner
 
That sentence of mine seems fucked up.
 
@RMartinhoFernandes I starred it. Does that make you feel better?
 
Not at all.
Hey, wasn't the reputation count supposed to never drift again since a few months ago?
> I was able to bowl in the arena with a debug cart ball and aardvark pins, with various cascades and skidding. Nothing against aardvarks -- the alphabet just works against them for once.
Dammit Toady, stop playing games and give us the damn minecart update!
 

« first day (557 days earlier)      last day (4406 days later) »