« first day (330 days earlier)      last day (4619 days later) » 

12:00 PM
In my case I have a std::function replacement that is move-only. What do I call it?
 
unique_function?
 
Right now it's forward_function but what with std::forward_list I don't think the name is terribly good.
 
Also it sounds like a function that uses forwarding.
unique_function does seem to convey the right thing.
 
@Potatoswatter Does that mean I should keep my forward_bind as it it ? :p
 
@LucDanton yikes. Well unique_bind isn't so great either. But then again I'm still unclear on the reason for distinct storage semantics between function and bind in the first place.
 
12:04 PM
unique_bind may be misleading as std::bind does return a move-only type where appropriate.
 
Is the intent that the functor stored by bind always be copyable, but the other arguments might only be movable?
 
forward_bind doesn't deal with move-only vs copyable issues (another reason why it's high time to make the name of my function wrapper unrelated to my bind)
Assume typedef std::unique_ptr<int> pointer; as an example move-only type
auto functor = [](pointer&) {};
then auto bound = std::bind(functor, pointer{}); is valid
decltype(bound) is move-only.
However if functor is [](pointer) {} instead
then bound(); results in an error
because the invocation passes the bound arguments as lvalues
Note that the behaviour from std::bind here differs from the behaviour of e.g. std::thread/std::async...
std::thread([](pointer) {}, pointer {}); is perfectly fine (well you have to detach/join it but that's not the point).
 
Oh, so forward_bind passes using perfect forwarding instead, in this case effecting a move?
 
Exactly.
I use it because there no capture syntax for move-only types.
Can't do pointer p; [&&p] { /* use p here */ };
 
Well, where would you call move in that case.
 
12:10 PM
Yep.
 
But unless forward_function is somehow related to this, its name should certainly be different.
 
[std::move(p)] { ... }; is somewhat clear in what it does but does that mean any kind of expression can be used? After all std::move is not a privileged or primitive language feature (the Committee argued that they didn't have the time to reflect on arbitrary expressions in the capture clause).
 
Since you just want to loosen the semantics of std::function, wouldn't it be best to still reduce to std::function where appropriate? A SFINAE template alias would be the best.
 
I can't due to the type erasure :)
 
Good point. The name must express the semantics because all the other information has been hidden.
 
12:18 PM
It's a function that must be transferred from one place to the other. Is this a good description?
 
Let's not call it transfer_function :vD
 
@RMartinhoFernandes It doesn't have to, but yeah it can do that.
std::deque<unique_function<void()>> callback_queue; should be a good example case :)
 
Is copying forbidden entirely or does the copy constructor produce a reference? Due to type erasure, that can be a hidden detail as well.
 
@Potatoswatter That would need shared ownership of some kind, so no it's forbidden.
 
@JohannesSchaublitb Is a "name" different from an "identifier"?
 
12:23 PM
@FredOverflow yes
 
In that case there's a natural dichotomy between unique_function and shared_function, which you will need to convert unique_function to a std::function.
 
an identifier can be a name, and a name can be an identifier
 
@FredOverflow Shell<T> is not an identifier.
 
@JohannesSchaublitb What would be an example of an identifier that is not a name?
 
a name can also be an operator-function-id, conversion-function-id, literal-operator-id or template-id
 
12:23 PM
@Potatoswatter I don't follow.
Oh I get it.
 
the identifier "hello"_lulz is not a name.
 
sorry, wires crossed. I've gotta call it quits soon.
 
a name will be constructed from _lulz, operator "" _lulz, which will be looked up
 
@JohannesSchaublitb that's a string literal, not an identifier.
 
You're correct that the semantics of std::function are not those of a shared_function.
 
cpx
12:24 PM
This is from C++ standard. A name is a use of an identifier (2.11), operator-function-id (13.5),
literal-operator-id (13.5.8), conversion function-id (12.3.2), or template-id (14.2)
that denotes an entity or label (6.6.4, 6.1).
 
an identifier is just a grammar construct. a name is an identifier with meaning
 
cpx
I'm not sure what it means
 
what @cpx says
 
@JohannesSchaublitb You're not sure what it means?
;)
I like unique. It expresses the fact that there is only one copy. What is it that you find wrong about it?
 
@Potatoswatter no, the _lulz in "hello" is an identifier
 
12:26 PM
yeah.
 
but it is not a name
it denotes nothing.
 
Your mother denotes nothing!
 
@Potatoswatter i suspect I was missing an "in" after "the identifier " :)
 
@RMartinhoFernandes std::unique_ptr is not a unique version of ptr. But apart from that, yeah it's good; I'm making the changes right now.
 
cpx
Hm, so when you use operator in overloaded function, does it denote a name because we are using the identifier operator?
 
12:28 PM
operator is a keyword.
@LucDanton Oh good. Can I take my turn now :)?
 
Go for it.
 
So, my intrusion into Boost.Intrusive didn't end up as well as expected.
 
operator is only an identifier in early phases of compilation (during preprocessing). it will be a c++ keyword token when pp tokens are translated to c++ tokens
 
@RMartinhoFernandes it was more of an extrusion?
 
cpx
ohh
 
12:30 PM
Basically, this snippet ideone.com/Dlhac compiles, while this one ideone.com/9nv7b doesn't compile.
The second complains that there is no copy constructor.
I'm baffled as to why.
 
So you can use operator as the name of a macro parameter, but not the name of a macro. If you care.
 
@RMartinhoFernandes Can you static assert that the cache thingy type is move constructible?
 
I think I can, but I'll confirm it.
 
you know those people who say CPUs are no longer getting faster at single-threaded workloads?
seems pretty obvious that they haven't actually tried running any singlethreaded code
 
Herb Sutter, yes. What do you mean? CPUs are getting more intelligent at the same clockrate?
 
12:33 PM
I'm seeing something like a 10x speedup from my 3-4 year old laptop to a new one
 
holy crap there's rain outside... water bubbles up from ground out of my shower
 
@FredOverflow he's just saying that's not where the main speedup is going to come from, which us true
@FredOverflow Individual cores do more work per unit of time, regardless of clock rate
 
@jalf Is the particular problem larger than one L2 cache but smaller than the oher?
 
Damn, my compiler doesn't have std::is_move_constructible.
Would cache_entry(cache_entry&&) = default; fail if the compiler could not generate it?
 
@Potatoswatter Nope. Should be smaller than both
 
12:35 PM
@Potatoswatter I think you can use operator as the name of a macro in c++03
in c++11 it is undefined behavior always
 
@RMartinhoFernandes My two hypotheses right now is that either the type is secretly not move constructible or that std::pair uses std::move_if_noexcept and the type is not noexcept move constructible.
 
Anyway, I'm not disputing that the rate of performance increase has slowed some, but it's nowhere near peaked
 
but you cannot use new as the name of a macro in c++03. that would be ill-formed
 
@JohannesSchaublitb The keywords are categorically forbidden.
 
and ill-formed in c++11
 
12:35 PM
There's still some fairly noticeable improvements going on
 
@Potatoswatter yes, but by undefined behavior
and only if you include a standard header in c++03
operator is a normal identifier without any special meaning in preprocessing stage.
 
according to the error message I wrote, (§17.6.4.3.1/2, 17.6.4.3.2/1)
 
while new and some others are preprocessing-op-or-puncs
 
UB is about as good as ill-formed in this context.
Including the standard headers only applies to names defined in the standard library, i.e. no macro named move.
 
@LucDanton The problem is that the pair constructor that gets selected in the bad code is the first one here: ideone.com/b14jj, when it should pick one of the others.
So, I guess it's not std::pair, though it could be std::make_pair.
 
12:37 PM
@Potatoswatter nono.
 
@jalf Personally, I don't really care. I have one of the slowest DualCores there are, and it's fast enough for me :)
 
it is not ill-formed nor UB in c++03 to say #define operator without including any standard header
 
@FredOverflow Just noticed it because my benchmarks show a minimal STM transaction taking around 2000 ns on one machine, and under 100 on another
that's pretty good for a time when the "free lunch is over" ;)
 
That might be explained by different "memory architectures".
 
that's in a single-threaded benchmark, btw. Just one thread creating and committing empty transactions
@FredOverflow yeah, I know, there are plenty of underlying factors, but at the end of the day, it's a pretty big difference
 
12:40 PM
@JohannesSchaublitb Hmm, I might have been taking Clause 17 out of context. Damn you, PDF search.
 
anyone know if @sbi managed to salvage that laptop, btw?
 
@jalf Also, I generally don't take measurements seriously that take fewer than a couple of seconds.
 
Compiler does not complain if I had cache_entry(cache_entry&&) = default;. However, I really cannot std::move from it. Hmm.
Maybe the hook is not move-constructible.
 
@FredOverflow This one takes a minute or two. I just divide by the # of iterations at the end ;)
 
12:42 PM
oic
 
I know timing at the nanosecond level is pretty unreliable. :)
 
@RMartinhoFernandes error: static assertion failed: ""
Not move constructible :(
 
I can confirm I get your first version to compile while the second complains around the same exact pair constructor.
 
@LucDanton Yeah :(. Is there somewhere I can see which boost libraries are already C++11 enabled and which aren't?
Because there's no reason for the hook to not be movable, right?
 
12:43 PM
@RMartinhoFernandes grep through the source code?
 
I don't expect such a list to exist.
 
if there are references to rvalue refs, it's a pretty good indicator
 
@RMartinhoFernandes I have no idea what it is/does tbh. Is it just a trait/policy?
 
Well, it's good news for the preprocessor project. I could almost simply delete the list of forbidden macro names, except that undefing ones used internally such as __FILE__ and __LINE__ would cause a crash.
 
@jalf You can't have a reference to a reference in C++ ;-)
 
12:44 PM
@LucDanton It adds the pointers and stuff for an intrusive doubly linked list.
Well, I already worked around it by implementing the list operations I needed manually :(
 
@RMartinhoFernandes If there is a copy constructor then there you go.
@Potatoswatter A preprocessor crash could be a fun instance of UB.
 
@LucDanton I have a strict no-crash policy :)
 
@LucDanton Oh, I tried to look into the hook source code, but it's too dense. Lots of TMP magic in there. :)
@FredOverflow You can in English :P
 
@FredOverflow So? search for RVALUE in the source code, and see what turns up. if you find something like BOOST_HAS_RVALUE_REFS ( I don't know the exact macro names they use, but they'll probably involve RVALUE), then the code obviously uses rvalue refs where possible, ie. it is C++11 aware
 
To be fair, I only have those two to check for, and I only have to stop the user from *un*defining them. If they want to redefine them to the currently-correct value, they can go for it.
 
12:47 PM
@jalf I was just trying to be funny ;-)
 
forbidding to redefine new an delete will reject relatively much code. but if you aim for full conformity you shoudl reject
 
@FredOverflow I don't get it ;)
 
@JohannesSchaublitb Those are classified as punctuators in phase 3, whether it makes sense or not is none of my business.
 
:/usr/local/include/boost$ grep "RVALUE" -Rn . | wc -l
176
 
That's not a lot, considering the size of boost.
 
12:49 PM
They're just entries in a table… it's easy enough to change it or add a pragma if I ever get a user and they ever ask :vP
 
Some of those grep hits are in Boost.Intrusive heh.
 
Anyway, there's currently a niche for purposely rejecting non-conformant code, not bothering to compile anything, since Comeau Test Drive is outdated.
There are plenty of effective, fault-tolerant compilers out there.
 
@Potatoswatter rejecting or flagging. I'd find it useful if I was notified of non-conformant code, but without necessarily having the compiler reject the code
 
@jalf You're supposing there's a backend. In this context the alternative to rejection is simply printing "pass" in friendly green letters.
 
12:55 PM
@Potatoswatter fair point :)
 
There's also a demand for a 'dummy' implementation that makes UB very explicit in every instance possible, for demonstration purposes. (The demand is essentially me.)
 
No, not just you.
2
 
There's also a demand for code that prints "pass" in friendly green letters. Everyone likes that
 
Some one asked if there was such a thing out there, recently.
22
Q: A C++ implementation that detects undefined behavior?

templatetypedefA huge number of operations in C++ result in undefined behavior, where the spec is completely mute about what the program's behavior ought to be and allows for anything to happen. Because of this, there are all sorts of cases where people have code that compiles in debug but not release mode, or...

 
@jalf I wouldn't trust that though.
 
12:59 PM
and comeau test online compiler accepts to leave out the "template" keyword even in strict mode :(
 
@RMartinhoFernandes To be precise my particular demand requires that a simple 'Nasal demons suddenly appear' message be printed as soon that it's established that the program is invalid. For educational/trolling purpose on the Interwebs.
Just to shut down all the 'Yeah but do you know of an implementation where this will go wrong' nonsense.
 
@LucDanton yeah, that'd be useful.
 
@LucDanton Well, given an implementation like the one suggested by templatetypedef in their question, it would be easy to plug in the nasal demons.
 
@LucDanton the LLVM blog series is pretty useful for that
 
@JohannesSchaublitb: Yes, once I reported a "bug" to Comeau that a diagnostic was missing, and they replied that the diagnostic wasn't required. They don't/didn't see themselves as a diagnostic tool.
 
1:02 PM
Clang has a -fcatch-undefined-behavior flag
 
@Potatoswatter thou I made comeau reject valid code
 
@jalf What does it do?
 
@RMartinhoFernandes tries to catch undefined behavior? ;)
 
because of it thinking when I left off template, it was still a template, but the spec requires it to think it is not a template
 
afaik, it generates a warning (or error?) for every instance of UB it can find
 
1:03 PM
@JohannesSchaublitb Yeah, it had bugs. I tripped it up once on namespaces.
 
also static analysis tools are your friends
 
Yes, but you can have lots of UB that only happen under certain runtime circumstances.
 
Halting problem and so on
(I think I'm starting to get out of the loop here, I think I need to focus on my video games.)
 
Yep. A UB detector would pretty much have to be an interpreter.
Possible integral overflow possibly going into an array index? Bad!
 
1:11 PM
Hello.
 
so want to explain information entropy to me?
 
@TonyTheLion in what context?
 
@jalf in the context of encryption
we were talking about that last night here, but I've never managed to wrap my head around entropy
 
Entropy is a measure of disarray.
 
@TonyTheLion think of it basically as how random the information looks. If there's a clear pattern to it, it has low entropy, and is easy to guess
 
Als
1:16 PM
Hello Gents
 
oh I see
Hello @Als
 
if you transmit a message in plain ASCII, it's pretty easy to read, even if you don't know in advance that it's ASCII. You can look at the frequency of each byte value, and pretty much reconstruct the alphabet
 
so entropy could be the amount of chaos in information?
 
but if you zip it, the bit stream looks a lot more random, and there's no clear correlation between how often a byte value occurs, and how often each letter in the original text occurs
@TonyTheLion yeah
 
oh I see, interesting
 
1:17 PM
you could say that
 
kewl, that makes sense
t'was easier then anticipated
 
something like that, anyway. I'm not an expert ;)
 
the more entropy a message has, the more space is needed to encode it (I believe)
 
unless you zip it?
oh
 
but the zip will be bigger than if it had less entropy. so for example "aaaaab" has low entropy. it can be encoded by "5ab". "abchdsfear" has high entropy.
 
1:19 PM
hmm
 
@TonyTheLion Some files shrink by, say, 99% when you zip them. Others retain their original size, give or take a few bytes
that's entropy in action
 
@TonyTheLion The entropy value of a message is the theoretical minimum space required to store it.
 
true, but that is also dependent on whether a lossless compression algorithm is used or not
 
You cannot possibly store a message with 10 bits of entropy using only 9.
@TonyTheLion Yes, if you use a lossy algorithm, you're basically reducing the entropy on purpose.
 
@RMartinhoFernandes so that's different then entropy itself?
so low entropy is high random information?
 
1:22 PM
No, low entropy is a low amount of information, lots of redundancy.
 
Well, don't oversimplify… run the number pi through zip and you get infinite data, but it has only a few bits of entropy.
 
6 mins ago, by jalf
@TonyTheLion think of it basically as how random the information looks. If there's a clear pattern to it, it has low entropy, and is easy to guess
 
Yes, patterns ~= redundancy.
 
this definition seems to conflict to what @RMartinhoFernandes is saying entropy is, or am I confused?
 
one cannot say "PI has low/high entropy" I believe
 
1:23 PM
If there's a pattern in it something is being repeated.
 
In algorithmic information theory (a subfield of computer science), the Kolmogorov complexity of an object, such as a piece of text, is a measure of the computational resources needed to specify the object. It is named after Soviet Russian mathematician Andrey Kolmogorov. Kolmogorov complexity is also known as descriptive complexity, Kolmogorov–Chaitin complexity, algorithmic entropy, or program-size complexity. For example, consider the following two strings of length 64, each containing only lowercase letters, digits, and spaces: abababababababababababababababababababababababababababa...
 
it depends on how you represent it in a message. the lexical representation has infinite entropy. but one could represent it in a formula with low entropy
 
@Potatoswatter We're talking about Shannon entropy (from information theory).
I wonder how does that relate to algorithmic entropy? Anyone?
 
1:26 PM
I don't agree with everything I said there anymore. but with most :)
 
I don't understand anything you said there, so that's not a problem :)
Ok, I understand "Hallo!".
 
im sorry, there is no english translation :(
 
Well… DNA doesn't encode everything.
(Hooray for Google)
 
What does that mean?
 
yeah what do you mean
 
1:32 PM
An organism needs more to reproduce than just DNA. There's a particular environment that needs to exist.
Think of it as the source text of a compiler, which is useless unless you have a self-hosting compiler to run it through.
 
And what's the compiler? The mother's womb?
 
Right.
 
What about starfish?
 
And think of the hack where you tell the compiler to insert some code where it sees some key text. The compiler can contain information besides its source.
@RMartinhoFernandes The more of the organism that participates in reproduction, the less you can say that DNA tells the entire story.
 
@JohannesSchaublitb interesting read, esp to learn more German :P
 
1:36 PM
xD thanks
 
But what is the compiler in starfish? They reproduce by fragmentation.
 
@RMartinhoFernandes That's only one way they reproduce. And you could say that the starfish itself is a quine with no need for a compiler.
These kinds of metaphors don't need to be perfect, anyway.
 
Yes they need!
:)
 
so we change subject from entropy to starfish
lol
 
hi
 
1:38 PM
We changed it from entropy to SEX.
 
Fragmentation is asexual, so technically we changed it to not-sex.
 
how much entropy does sex have?
 
hmm
SpEcified compleXity
 
S tack EX change
 
1:40 PM
lol
 
lulz
ORL and ANL
 
so essentially, this is all about sex here, it's just hidden
lulz
 
im going to name the token && ANL in my compiler haha
 
ANL?
why?
 
because. AndLogical
 
1:42 PM
That's just silly.
 
logical and.
 
LOAND and BIAND
 
I guess @Tony didn't get the joke.
 
and the AST dumper SexPrinter, since it outputs in SEXP notation
 
@RMartinhoFernandes yes, I did get it was supposed to infer "anal"
lol
 
1:47 PM
bitches
 
I don't see any?
 
humm not even the java bitches are here
:D
 
in ADL, what are considered to be the "pathological cases" that need to be handled?
Java is a bitch
 
It's so funny to me that I can use a for loop to generate a "hand check" for homework. The teacher wanted it typed anyway.
 
1:49 PM
@TonyTheLion Most anything to do with the non-template friends inside templates took a long time for the compilers to get right.
 
What's a "hand check"?
 
hmm
@Potatoswatter this no compiler gets right:
 
@RMartinhoFernandes When you manually do the math by hand to make sure your program is working out the math correctly.
@RMartinhoFernandes I can generate the trace too.
 
enum class hand { left, right };
 
:-D
 
1:50 PM
@Potatoswatter oh I see, but I don't see how the use of "pathological" fits therein, I mean pathology is a biology thing.
 
@TonyTheLion WTF, you want the compiler to get sick and physically vomit?
 
@Potatoswatter no, but in my book it talks about the "pathological cases" in ADL that need to be handled
> There are many small details to looking up names in C++, but we will focus only on a few major concepts. The details are necessary to ensure only that
(1) normal cases are treated intuitively, and (2) pathological cases are covered in some way by the standard.
damn, I can't get to show as a quote
 
"Pathological" in the general sense just means "causing problems."
 
yes, like surrogate call functions
 
1:53 PM
@Potatoswatter oh I see, thanks for that
 
and "ambiguous conversion sequences"
 
Basically, that just means "weird stuff you hope you won't run into".
 
very pathological
 
lol
@JohannesSchaublitb what are those?
 
en.wiktionary.org/wiki/pathological : 4. (computer science) Having properties that cause unusually bad behaviour, especially regarding correctness or performance.
 
1:54 PM
struct A { operator long(); operator unsigned int(); }; void f(long); void f(int); int main() { f(A()); }
 
@TonyTheLion I think the overload resolution appendix explains surrogates.
 
this will use an ambiguous conversion sequence
 
@RMartinhoFernandes oh cool
 
and hence be ill-formed
note that the presence of void f(long) will not fix it
 
1:55 PM
@TonyTheLion Yeah, page 496.
 
never mind
 
Do you think using a recursive mutex is a code smell?
 

« first day (330 days earlier)      last day (4619 days later) »