« first day (506 days earlier)      last day (4424 days later) » 

6:00 PM
@LucDanton No, it's really rhetorical.
 
Xeo
@PaulManta The problem is that getline is specified as follows
 
0
A: std::getline(std::cin, custom_class); type mismatch

R. Martinho Fernandesstd::getline is a function template that looks like this: template< class CharT, class Traits, class Allocator > std::basic_istream<CharT,Traits>& getline( std::basic_istream<CharT,Traits>& input, std::basic_string<CharT,Tr...

 
Xeo
Okay, the robot was faster
 
2 mins ago, by R. Martinho Fernandes
@PaulManta That reminds me, I need to finish writing that answer.
@Xeo The answer was left there written, waiting for me to press "Post" while I discussed with Luc. If @Paul didn't mention it, it would still be waiting...
 
Xeo
6:02 PM
Ah
 
@LucDanton figured it out. When using GCC via MSVC, I have to save the file before I can compile it.
 
Xeo
2
A: Why can template instances not be deduced in `std::reference_wrapper`s?

XeoEdit: Moved my guesswork to the bottom, here comes the normative text why this won't work. TL;DR version: No conversions allowed if the function parameter contains a deduced template parameter. ยง14.8.3 [temp.over] p1 [...] When a call to that name is written (explicitly, or implicitly...

Dupe of this, btw
And I finally realized why my answer was considered wrong
I wrote the same as you, @RMartinho, i.e. that no conversions are allowed. Fact is, standard conversion sequences are allowed, just no user-defined ones.
 
@Xeo I'm having trouble coming up with an example where that matters, though. Do you have one?
 
Probably something with decay?
Mmh I think decay happens before that in the case of parameters taking T though.
 
Xeo
template<class T> struct X{};
template<class T> void f(X<T> const volatile*){}
X<int> const* p = nullptr;
f(p);
> If the original P is a reference type, the deduced A (i.e., the type referred to by the reference) can be more cv-qualified than the transformed A.
As another example
It's really just user-defined conversions
 
6:07 PM
@RMartinhoFernandes Come to think of it tuples::apply doesn't work with void returns anyway so maybe it's not worth fussing about all that? I could have a utility that wraps a functor to make it return an empty type in case of void, too, to shift the burden to client code.
Or I could do that in invoke actually, which is (should be) used by all of my generic code that, well, invokes functors.
 
Xeo
Oh, and I personally think that UCSs through conversion operators should be allowed in template argument deduction, if the conversion operator isn't templated.
Since those would yield an exact match
As in the string type / getline example
I can understand why conversions through constructors are a no-go, as that would equal to the halting problem, but conversion operators should work perfectly fine if not templated
 
void is annoying. Types with no values are worthless. Types with one value are useful (even if their single value is worthless).
 
Xeo
lol
 
It's not meant to be funny.
 
So what do I return? empty_type?
 
Xeo
6:11 PM
Anyways, dinner
 
I want to avoid the situation of Boost.MPL which seemingly has a myriad of void_, empty, null or whatever.
I already have a void_ but that's a constant metafunction.
 
@LucDanton void() is ok as return value spec for a void result
 
@LucDanton Oh, I'm not suggesting that. Just venting.
 
@CheersandhthAlf Sorry, this is about the return type, not the returned value. Abuse of language.
@RMartinhoFernandes I want to try it tbh.
 
What about void operator*()?
Nevermind, fails in the for loop.
 
6:13 PM
@LucDanton what's wrong with plain void then?
 
'Fixable' with a (sigh) specialisation for the iterator though.
@CheersandhthAlf apply(f, tuple) returns a tuple containing the values obtained from applying f to each element of the tuple. What to do when the return type is void for some element type?
I can drop the element altogether though.
 
@LucDanton sounds like a job for Optional
 
Wait, there is a standard unit type! std::tuple<>!
 
@CheersandhthAlf I can't just forget about all the values of non-void type though.
 
Is boost::variant<> allowed?
 
6:17 PM
@LucDanton general guideline: think about how you'd like to use that thing, then design it to support the desired usage
 
@CheersandhthAlf That's what we're doing, yes.
 
31 mins ago, by Luc Danton
And forget about making for(auto&& result: apply(f, option)) { ... work in generic code? That seems worthwhile.
@EtiennedeMartel Is that in Canada?
 
@RMartinhoFernandes Yep. Joliette, Québec, Canada.
 
@RMartinhoFernandes I checked std::is_empty<std::tuple<>>::value for curiosity and it's true with my implementation.
I doubt that's either reliable or completely needed though.
 
@EtiennedeMartel Sweet, we're not the only ones.
@LucDanton Why wouldn't it be empty?
 
6:19 PM
@RMartinhoFernandes Implementation from hell?
@RMartinhoFernandes No.
 
a void result can only be used in one valid way, namely as a return value.
 
@LucDanton Well, yeah, there's nothing preventing it. So... sizeof(std::tuple<>) > sizeof(std::tuple<int, int, int, int>) in Hell++.
 
Getting back to apply(f, tuple) I think it's not a good idea to drop elements as I want the identity get<I>(apply(f, tuple)) == f(get<I>(tuple)) to hold, so I do have to provide a 'dummy' type in the return type.
 
> 1972 - Dennis Ritchie invents a powerful gun that shoots both forward and backward simultaneously. Not satisfied with the number of deaths and permanent maimings from that invention he invents C and Unix.
2
^ lol.
 
6:22 PM
@LucDanton And that's std::tuple<>.
 
So for the time being I'm going to map void result types to an empty type. Which reminded me I want to investigate std::ignore.
 
Any implementation that doesn't make that empty is actively fighting you.
 
@RMartinhoFernandes Well I do want to discuss what empty type to use now, yes :p
std::ignore has no specified type and really no other specification than how it's supposed to make std::tie work. Let's not use that.
 
Yeah, that's one of those values that should be treated as magical prvalues.
Is std::nullptr_t empty?
 
Investigating but for the record I don't think I'd pick that.
 
6:26 PM
(btw, what do you use as your none value? I use nullptr)
 
I wanted to investigate std::ignore for that purpose originally. Although I didn't give that much thought to it.
So I don't have one atm.
I feel like {} works well tbh.
 
why was it decided that class definitions in C++ have to have a semicolon? What's the ambiguity if it was left out?
 
But now I have the problem that I can't default construct in-place.
 
You can't do class foo { } bar; with no semicolon :(
 
6:29 PM
@rubenvb It's a C syntax artifact.
 
@Pubby what would that mean anyways? I interpret that as definition of foo followed by undefined identifier bar. I guess it's a holdover from C's inline struct definitions...
ugh.
 
@RMartinhoFernandes Unspecified, I think. Also looking at the specs for std::nullptr_t it really seems like the wrong type to use (as an empty type).
 
Aren't those things always holdovers from C.
 
I think the trouble is not with void but with std::tuple
 
@rubenvb It's a definition of a class foo and a variable bar of type foo.
 
6:30 PM
man
 
@LucDanton Ok. Just tossing out names.
 
I feel so much better since I took various painkillers
 
@RMartinhoFernandes yeah well, that's just F-ugly in my eyes.
 
@CheersandhthAlf In what way? Wanted std::tuple<void> to work?
 
Making your own empty type is probably the best option.
@DeadMG You're on drugs?
 
6:32 PM
not any illegal or even prescription ones
 
Evil stomach again?
 
nah, the temperature in this place is pretty variable and I caught a cold
my immune system is really bad at dealing with them, I get very nasty headaches
 
oh yeah, and the stomach too, but painkillers have no effect on that, I long since stopped trying them :P
 
@LucDanton Yes. I think the only thing that's needed is some way to instantiate that beast. Or rather one's own Tuple. But to have get<k>(t) be a void. To instantiate, simply some internal type and function producing that type.
 
6:37 PM
My languages "Standard Library" will be abbreviated to TSL. Niceness.
 
Transportation Security Library?
I don't like the idea of instantiatable std::tuple<void>.
 
"Twisted Standard Library", for Twisted C aka CTwist. Think of the twist as an infinity symbol merged with the letter "C", and an opening at the top of the "C".
 
@RMartinhoFernandes But that's because you don't like void right?
 
Possibly.
I'm still probing my own reasons.
 
Damnit, the innards of my variant implementation is an abomination from hell. I need an std::aligned_union emulation.
 
6:41 PM
std::aligned_union is still missing?
Damn.
It should be easy enough though.
 
Can't unpack members, can't use inheritance.
Recursion? template<typename T, typename... Ts> union foo<T, Ts...> { T head; foo<Ts...> tail; };
 
template <typename... T> struct aligned_union { struct type { alignas(T)... char unnamed[sizeof(max(sizeof(T)...))]; }; };?
 
I use such a recursion but for an unrestricted union rather than computing a buffer, so I get all sorts of crud to visit that.
 
Sadly, alignas is missing too.
 
@RMartinhoFernandes That's a valid expansion site?
 
6:44 PM
Yes.
But I guess alignas(max(alignof(T)...)) can be made to work.
 
@RMartinhoFernandes Clang 3.0 has it...
 
That's awesome tbh.
Mmmh I'll tear down my silly unrestricted union another day I think.
Yay, more GCC failures.
 
Frak. I forgot to make my /tmp bigger again. Clang build failed. Why I don't just make it bigger by default I don't know.
@LucDanton Oh, sorry, I got it wrong. It's alignas(T...).
 
@RMartinhoFernandes put it in RAM?
 
@rubenvb It is in RAM.
 
6:49 PM
@RMartinhoFernandes ah, get more RAM?
 
@rubenvb That's not a problem. I have virtual memory.
The problem is that it is mounted as 1GB only. Clang needs >2GB to build.
 
I think GCC is forcing my hand and I have to redo variant.
 
I usually remount it to 3GB before building, but now I'm going straight for /etc/fstab.
 
@RMartinhoFernandes whut? really? Not on my box. 1GB is a lot. Are you sure there's no cruft from other programs in there?
 
@LucDanton What's wrong with Boost variant?
 
6:51 PM
I had job interview today, It really went very bad :(
 
@DeadMG No moves.
@rubenvb There's ~1MB in use.
 
aaah
epic fail
 
And the StaticVisitor concept cramps my C++11 style.
 
@DeadMG Yeah, it's annoying. Same goes for Boost.Optional.
Hmm, my alignas emulation can't handle alignas(T...).
 
How silly, I have a min/Min but no Max.
 
6:59 PM
No, wait, alignas(T)... is valid.
I'm confused now.
> An alignment-specifier with an ellipsis is a pack expansion (§14.5.3).
alignment-specifier:
alignas ( type-id ...opt )
Arrgh, I gotta check Andrei's slides from GN.
 
is print a logical name for a generic output function? For both console, file, and network I/O?
 
uh, print to the network? or to a file? no way
 
as in std.io.print("bla") and some_file_representing_object.print("bla") and some_network_stream_representing_object.print("bla")?
 
write? put?
 
why not just use std.io.output("bla")?
 
7:05 PM
@DeadMG hmm, simple and effective
 
i.e., through operator() overload for the output object
 
@DeadMG yeah, well, all functions will be function objects for obvious reasons in my language.
 
I prefer read and write
 
and in the Wide IO design, I had input as like, std.io.input(int)
 
What, not return type deduction?
 
7:06 PM
@DeadMG "had"? You didn't give it up did you?
 
uh
 
@RMartinhoFernandes huh?
 
void f(int); void f(float); f(std.io.input()); // wut?
 
Ell
for getter/setter haters drdobbs.com/cpp/184401197
 
How does input work by taking int by value anyway?
 
7:07 PM
@rubenvb No, just a break
@RMartinhoFernandes it's kinda similar to template<typename T> T input();
 
It's declared as input(type), isn't it? Or perhaps that was an earlier design.
 
@DeadMG ok, cause you came quite a ways already, would be a shame to not have a full proof-of-concept or better after venting all that anger in here.
 
@DeadMG Oh, it's the template parameter. Right.
I forgot you had gone with () all the way.
 
@LucDanton Yes. "similar to" being "In C++ syntax", as it were
not that I even have templates as an explicit system
for me parametric polymorphism is a subset of all metaprogramming
 
I saw input(int) as a declaration, not as a call.
 
7:10 PM
ah
no
 
So it made little to no sense.
 
strictly, it would be more input(int)(), I think
can't quite remember
 
@DeadMG what are your fundamental types?
 
what fundamental types?
I don't think I have any
 
integers and the like
 
7:12 PM
oh, references and pointers, I guess
 
what type is the literal 42 in your language?
 
arbitrary size integer
 
is that a library class or compiler thing?
or just an LLVM int32?
 
uh
bit of both
certainly not LLVM type
 
sbi
@DeadMG He might be asking about your char. Are you a choleric, a phlegmatic, a melancholic...?
 
7:15 PM
rofl
 
Prelude> :t 42
42 :: Num a => a
 
@DeadMG you are not rolling on the floor.
 
@rubenvb Dogs do that often.
 
woof woof
 
ugh
 
7:16 PM
In Haskell 42 is polymorphic.
 
sbi
Well, since it reminds me of Douglas Adams, I'd characterize the number 42 as a nostalgic type. Would that fit with your language, @Dead?
 
no
 
@RMartinhoFernandes it has to collapse to some determined type at some point?
 
What's the way to overload perfect forwarded function?
 
@Pubby SFINAE usually.
Wait, forwarded, not forwarding? My bad.
 
7:19 PM
@rubenvb You pick that type. As long as it's a Numeric type, it works.
 
@LucDanton Can you show example? I mean like I want template<T> foo(T&&) to do different things for int and float
 
@Pubby What does foo forward to?
 
@RMartinhoFernandes uhu, I can see the use of that. How does integer <> double stuff work then. I take it floating point types are "better" than int's, so that 3/5 is not equal to 1?
 
Are you sure you're not asking how to overload perfect forward ing functions?
 
sbi
@DeadMG Aw, too bad, But then, you're too young for nostalgia anyway. Plus you're probably not the type who reads anything but computer literature. I shoudda know, really.
 
7:20 PM
@LucDanton Different functions depending on the type. I dunno the correct terminology
 
@rubenvb There are no implicit conversions.
 
@LucDanton that does not make sense to me in the current context.
 
@sbi He once mentioned he read Ender's Game.
 
@rubenvb I thought you mean conversions by writing "integer <> double". If that's not the case, then what I said is irrelevant.
 
Prelude> 3/5
0.6
Prelude> :t 3/5
3/5 :: Fractional a => a
 
7:22 PM
I used to read quite widely
not recently, though
 
@Pubby First, you're aware that writing void foo(int); and void foo(float) is acceptable here right? We're using int and float for the sake of an example.
 
why read about other people's fantasies when I can create my own?
2
 
sbi
@RMartinhoFernandes I'm sure his parents also read him books when he was little. So? I wasn't speculating about his past.
 
@RMartinhoFernandes ok, so for output it's converted to some predefined/default format, otherwise it remains a fraction. Got it.
 
@DeadMG it might be possible they had different experiences and thus thoughts and concepts than you had.
 
7:23 PM
@DeadMG A strong imagination is a powerful tool. Or handicap.
 
@LucDanton I need to forward it (actually I'm using std containers). I can just specialize it with remove_reference, right?
 
@rubenvb Yeah. So I'd like to crack on using mine.
 
@rubenvb No, the second thing with :t is me asking for the type of the expression. 3/5 is always 0.6.
 
sbi
@DeadMG Because it might give a perspective on the limitations of your own. Wait. Yeah. Well, that fits, huh?
 
@Pubby Don't specialise if you can overload.
 
7:23 PM
@LucDanton How to overload if I need to forward? :S
 
@sbi Eh. In my experience, once you've sampled literature, rarely do they come out with anything new.
 
@Pubby I'm not sure why you need to forward. But let's restart from the beginning: what do you want to achieve?
 
@DeadMG Right.
 
@RMartinhoFernandes uhu. Is :t .6 also Fractional?
 
@rubenvb Yes. (Not Fractional though. Some type a that is Fractional. You can think of the part left of => as C++ concepts to some extent)
 
7:25 PM
@rubenvb It might be interesting to check what the type of (/) is.
 
@LucDanton Actually, I think I figured it out. What I am trying to do is initialize a union depending on the argument type of the constructor.
 
sbi
@DeadMG I think I remember hearing about the number of books presented at the Frankfurt Book Fair in one year and calculating that you'd be unable to read them all within several lifetimes even if you read one book per day. Given that the publishers will only bring their best books to a fair, it's easy to see that 99.999% of all books published cannot contain much (or anything) new. That still leaves quite a lot of interesting new stuff to read, though.
 
that's true
but I can have interesting practically any time I like from any source I like
more concerned about issues that I find directly problematic
 
Xeo
@RMartinhoFernandes You should only need so much temp space for debug build
Release build is compiling cleanly even on my crappy vbox
 
@Xeo No, it's not debug.
 
Xeo
7:30 PM
Okay...
 
I need the same thing for GCC, btw.
 
Xeo
Then I have no idea why you need so much space. Compiling with too many cores concurrently?
 
Two cores.
 
Xeo
Okay, same as me
And I got 2GB swap + 512mb RAM
peak usage is at some 800mb IIRC
 
@RMartinhoFernandes that's weird. /tmp or %TEMP% should only be used for intermediate assembly files or some cruft when linking. These files should disappear as soon as the gcc call is finished.
 
7:33 PM
@rubenvb What about object files for linking? FTR I run the entire download source + build process on /tmp.
 
@RMartinhoFernandes oh, that changes the story. That's a weird way of compiling something IMHO.
 
There isn't a single byte written outside of /tmp before I get to the actual install part.
 
Xeo
Ohey, random downvote again
 
My LLVM+Clang RelWithDebInfo build directory is 6.67 GB.
 
@Xeo I'm not talking about GCC memory usage. I'm talking about disk space here.
 
Xeo
7:35 PM
This time on my registers question.
@RMartinhoFernandes Oh. What?
 
It happens that I'm using RAM as a disk, but that's an implementation detail.
 
@Xeo It's a Robot, no shit he's using RAM as a disk.
 
@rubenvb See?
 
@RMartinhoFernandes I don't have gazillions of GBs of RAM. I want to be able to do stuff while compiling bigass projects
and not realize my ramdisk wasn't big enough halfway through.
 
@rubenvb I do that a lot when I'm testing I/O projects. I typically use a 2 - 4 GB ram drive.
 
7:37 PM
IME disk activity prevents me from doing other stuff more often than RAM usage.
Dammit, Andrei doesn't list alignas in his expansion loci slides.
 
@RMartinhoFernandes how much RAM've you got under that shiny head of yours?
 
@rubenvb Little. 4GB.
 
@Mysticial: Just the person I wanted! I wrote this test to time various answers to some question. It tests a baseline and several functions and times them. Seems to work fine in VC++, but when I compile with G++ (MinGW) the baseline takes ~4x as long, and the tests all run faster than the baseline. Could you offer me a tip as to what I did wrong this time?
 
awww... I feel wanted. :)
 
@RMartinhoFernandes wtf? And you're RAMdisking? Damn.
 
7:41 PM
@MooingDuck Haha, oh THAT question, lol.
 
@Mysticial oh wait... I see a flaw in my test arleady.... I SPENT HOURS TRYING TO FIND THE PROBLEM
 
What site would you put this question on? I put it on here, but then thought I could put it on Apple or Serverfault. Ideas?
 
Xeo
@MooingDuck Good ol' rubber ducking?
 
@rubenvb As I mentioned it's only 1GB, unless I'm building Clang or GCC.
 
@MooingDuck So I'm the rubber duck? That's awesome.
 
Xeo
7:42 PM
I wonder if it's "rubber cowing" in the case of @MooingDuck
 
@RMartinhoFernandes but linking Clang is a bitch memory wise, no?
 
Total memory usage of running processes is usually around 800 MB~1GB, zero swap, depending on how far Firefox wants to go.
 
Xeo
@rubenvb Debug is
my 3.5gig real + swap barely hold
 
Firefox is using about 1.5 GB for me right now. I've seen it go up to 2.5GB before...
 
Xeo
The fuck? Just how many tabs have you open?
 
7:44 PM
Yay! MinGW-w64 std::thread with a libstdc++ dll work!
 
Xeo
I'm complaining already if it's reaching 300mb...
 
I'm going to upload a GCC 4.6 now
 
250MB here.
 
christ, why do I do this to myself? I leave for 2 hours and I've been pinged 20 times, presumably on MSO
 
Okular with the C++ standard is taking up 130MB.
Ow.
 
7:45 PM
@Mysticial alright, fixed the test, GCC is still confusing me.
 
@RMartinhoFernandes that does suck. Sumatrapdf is only 43 MB
 
@MooingDuck The numbers are still messed up?
 
@rubenvb It probably keeps the whole document in RAM, so I can't complain. I paid for that RAM, and it is using it.
 
@RMartinhoFernandes Scrolling through it puts Sumatrapdf at 88 MB.
 
@Mysticial yeah. GCC is still half the speed, with the baseline 3.5x slower than VC++.
 
7:47 PM
TBH, I wouldn't mind dropping $500 USD into a ton of ram if it ups my productivity by even 20%.
Spread out over a few months, it more than pays for itself.
 
Why pay if you can get it free? downloadmoreram.com
 
@MooingDuck what are we measuring? Compile times or something?
 
Yeah, I really love that site.
 
@MooingDuck I'd have to look as the assembly dumps to start guessing. Are you enabling optimizations on GCC?
 
@jalf runtime
 
7:50 PM
@jalf lol
 
@Mysticial GCC command is "*.cpp -Wall -std=gnu++0x -pedantic -Wextra -O2 -Weffc++ -o$(TargetDir)gcc$(TargetName)$(TargetExt)"
 
@RMartinhoFernandes I found it on the net somewhere, and it allows rvalues. I didn't question it further
 
Oh right. Can't say I've ever noticed VC++ being particularly fast either
 
It allows rvalues? What?
You mean rvalue references?
 
Xeo
7:51 PM
@MooingDuck Yeah.... -std=c++0x does too, and disables all the GCC faggotery
 
@RMartinhoFernandes yes, or maybe I never actually tested it, not sure now that I think on it
 
Then you should be using -std=c++0x. You don't want GCC crackpot extensions.
 
@RMartinhoFernandes k
 
@MooingDuck Is GCC consistently slower on all the tests?
Now that I actually look at your test code, the first problem that I'm seeing is that you're using function pointers...
 
Surely you mean function putters.
 
7:54 PM
@RMartinhoFernandes whatever...
AFAIK, function pointers suck for performance. Every time you call a different function pointer, you'll hit a branch-target misprediction.
 
@Mysticial with VC++, tests are 2-4s, each plus or minus .005s or so, with GCC tests are 17-19s, haven't tested enough to estimate variance much. No worse than plus or minus a second
 
Anyways, details aside, if the compiler can't optimize out those calls and inline everything it won't be a good test.
 
@Mysticial but VC++ should have that same issue, I was deliberately attempting to avoid inlining, because I thought it was a good idea
 
@MooingDuck Try throwing in -fwhole-program for the lulz.
 
@MooingDuck All compilers are equal, but some are more equal than others.
 
7:57 PM
@Mysticial so VC++ is handling the function pointers better maybe? That makes more sense.
 
I wouldn't know unless I see the assembly. Also note that the calling conventions are different between Windows and Linux.
 
Oh right, I did the function pointer thing, because it was an easy way to be sure all functions used the exact same test harness
 
Yeah, that's why microbenchmarks are tricky.
 
@Mysticial I just recalled that I set the default calling convention in VC++ to "fastcall". That seems.... very related... now that you mention it...
 
7:59 PM
fastcall just passes the first few params in registers, even in 32-bit code
 
@jalf which would be faster than using GCC's default calling convention
 
Of all the code samples there, some have longer dependency chains, but you can run like 5 of them in parallel. Some are faster, but less amenable to ILP...
 

« first day (506 days earlier)      last day (4424 days later) »