« first day (690 days earlier)      last day (4254 days later) » 

5:00 PM
I still find myself typing () out of habit, but {} work in all cases, so I don't see a problem in using them everywhere
 
@Prætorian because it does the wrong thing in many situations.
 
appeal to authority, where the name is the authority
 
@Prætorian std::vector<int> myvec{1, 2}; how many elements in myvec?
 
2
1 and 2
 
@Prætorian stupid vector
 
5:02 PM
:)
 
^ watching this is real time was awesome.
 
I tthought you had to have {{ for initialization list
 
@DeadMG not in C++11, {{ was just for C++03 std::array
 
i think that's only for aggregate initialization
 
@Prætorian {} doesn't work in all cases.
 
5:03 PM
no wait, that was the right code, just I did the wrong thing with it
 
@MooingDuck I use it often.
 
@R.MartinhoFernandes I knew I shouldn't be saying that even as I was typing it. So where does it fail?
 
namely, {} initialization makes it a pain to use the std::vector<int>( size_type count, const T& value = T(), ... constructor
 
@Prætorian std::vector<int>(2); vs std::vector<int>{2};.
 
@Prætorian construct a vector with 300 integers (without providing an allocator)
 
5:05 PM
@R.MartinhoFernandes Yeah, but those are 2 completely different things
 
@Prætorian So?
That's exactly the problem.
You can't do both with {}.
 
@Prætorian that's the problem, can't do the first with {} everywhere
 
I didn't mean replace all () with {}. If you invoke the wrong constructor that's your own fault :)
 
5 mins ago, by Prætorian
I still find myself typing () out of habit, but {} work in all cases, so I don't see a problem in using them everywhere
 
Xeo
@MooingDuck There is no such constructor anymore
 
5:07 PM
@Xeo I disagree?
 
@Xeo There's no way the Committee removed a vector constructor in C++11.
 
@MooingDuck The issue remains, but the ctors were "rearranged".
@DeadMG They did!
 
they'd break a metric shitbunch of code.
 
oh hey, they "replaced" it with a slightly different one
 
@MooingDuck I am not that strict, but yes, I agree that we should fight this opinion that {} works everywhere.
 
5:08 PM
well
 
explicit vector( size_type count, const T& value = T(),const Allocator& alloc = Allocator()); (until C++11)
     vector( size_type count, const T& value, const Allocator& alloc = Allocator()); (since C++11)
explicit vector( size_type count ); (since C++11)
 
as long as size_type, const T& is a valid constructor call, regardless of the exact original form, it will always make constructing vectors of integral types more difficult
@R.MartinhoFernandes Oh well that's hardly removing it.
 
@MooingDuck Ok, that should teach me not to be more specific in this room
I didn't mean use {} if you want to invoke some other constructor, only when you want to perform list & aggregate initialization
 
@Prætorian lots of people say "always use {} now", and it's just wrong
@Prætorian see, that's what I started with, and people keep disagreeing with me
 
5:11 PM
As always with C++, it's more like "never stop thinking".
 
@Prætorian in fact, you saying to always use it was a counterargument to me saying that.
 
@MooingDuck Yes, I agree, if always literally means always then they're wrong
 
related: "uniform" initialization was a stupid name, since not all constructors are uniform even with it.
 
Feel free to comment on my Code Review question.
 
Your code sucks.
2
That's too short for an answer, and that's why I didn't post it. I swear.
:P
 
5:14 PM
@StackedCrooked ToString could be implemented using std::map. :P
 
back to my original question: what are people's opinions on when to use () vs {}?
 
@daknøk Lol no.
 
@MooingDuck I don’t mind using {} everywhere except those edge-cases where you can’t, where you need (), which makes C++ code fugly (as always).
 
@MooingDuck I just throw them around :P
 
@R.MartinhoFernandes Not sure if joking..
 
5:16 PM
@StackedCrooked I hadn't even clicked the link.
 
Even more unsure now!!
Oh wait. I guess you were joking then.
 
Always assume that your code sucks.
 
Ell
@MooingDuck I didn't even know what using {} is for
 
@Ell std::vector<int> a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
 
@MooingDuck I dislike {}. IMO it should be for initialization lists and nothing else.
2
 
5:17 PM
@DeadMG me too for the most part.
 
@MooingDuck I like return { ctor, args, here };
 
@DeadMG I agree with that, but also tolerate it for conversions and default constructors.
 
default_initialized<A> a;
 
I mean if you dislike {}.
But then you can't use a.foo() anymore :(
 
5:19 PM
A a;
 
@R.MartinhoFernandes Wide permits that without uniform intialization.
 
@daknøk Fail if POD.
 
A a = A();
 
Oh yeah.
 
@DeadMG Who said anything about Wide? Why are you openly advertising your products like that?
 
5:19 PM
A a(); trollolol
 
@R.MartinhoFernandes GG.
 
Most vexing parse is most vexing.
 
@StackedCrooked moves, but tolerable
 
actually, it's because I completely hadn't considered that that would be an effect of the system I designed
 
It's elided.
 
5:20 PM
but when I saw your code, I realized it would completely work that way
 
@daknøk life would be better if they just said no function declarations inside other functions.
 
Plus if it's not a POD, A a; works.
@MooingDuck I doubt it would break much code.
 
@daknøk Sometimes compiler even seems to refuse something like A a(b); or A a(B()); . Don't exactly remember the situation.
 
@StackedCrooked second one.
 
@R.MartinhoFernandes I know it would break my code at work, but it's a trivial fix.
@StackedCrooked a is a function that takes a (function pointer which takes no arguments and returns a B) and returns an A.
 
5:22 PM
No.
 
@MooingDuck which takes a function that returns a B.
 
@daknøk er, right
 
a is a function which returns an A and takes a function that returns a B.
 
ARkh, I'm getting tired of these:
0
Q: Howto convert a System::String^ to a std::string ... again

BenOf course I have read this question. I tried Colin's solution msclr::interop::marshal_context context; std::string standardString = context.marshal_as<std::string>(managedString); but I'm getting a compiler error: error C2065: 'WC_NO_BEST_FIT_CHARS': undeclared identifier and I don't...

 
@StackedCrooked that'll fail if A is non-copyable, won't it?
 
5:23 PM
@Prætorian Yep.
 
Function declarations inside of function bodies in C++ that are not extern "C" are so fucking useless.
 
@Prætorian If it isn't POD A a; works.
 
@amit Judging by the use of <iostream> header, along with the <c..> headers, I'd say C++. However, after looking at the code itself, it looks like someone is refusing to use the pleasantries of C++, and instead just using C. In fact, I see no use to call this C++, as it has nothing to do with C++ at all. — Drise 2 mins ago
 
@R.MartinhoFernandes Of course
 
Wait.
 
5:27 PM
Seriously, what were you expecting?
 
Are function declarations inside of function bodies always unmangeld? ideone.com/ToHV0
 
No, why would they?
 
Because that code works.
 
Or do function declarations not hide previous declarations?
 
5:30 PM
Mangling is irrelevant. There's a function in the global namespace named puts with that signature.
 
mangling is an implementation detail
 
@daknøk why would it hide?
 
@daknøk Function declarations with the same name either redeclare or declare overloads.
 
5:49 PM
@Prætorian If you were going to change something here, I think the thing to change would be to just say all locals get value initialized if no other initialization is specified (i.e., change the last bullet of §8.5/6 to say: "Otherwise the object is value initialized."
 
@R.MartinhoFernandes ah ok. So it probably wouldn’t have worked when I didn’t include <iostream>?
 
Erm, what?
That makes no difference.
The function still exists.
 
@R.MartinhoFernandes he'd probably get a linker error, isn't that function inline?
oh, puts, nevermind.
 
that awkward moment when you realize the AbstractSingletonProxyFactoryBean you thought was a joke exists https://jira.springsource.org/browse/SPR-8680
 
@R.MartinhoFernandes Wouldn’t you get linking problems then? How would the compiler know in what namespace any other declarations might be?
 
6:03 PM
@daknøk Wut? Declarations are exactly in the namespace they are in.
 
Yeah.
 
Would you please start making sense?
 
@R.MartinhoFernandes unless they're in a function, then they're in the same namespace as that function.
 
@MooingDuck That’s what I meant.
int puts(char const*);
namespace foo {
    void bar() {
        int puts(char const*);
        puts("Hello, world!"); // which one will it pick?
    }
}
 
Xeo
@daknøk innermost matching name
 
6:05 PM
@daknøk that would be a linker error. (assuming ::puts had a definition but ::foo::puts didn't)
 
It is virtually impossible to implement the innermost puts.
 
@daknøk using
 
Xeo
@MooingDuck puts is a declaration inside bar
 
@Xeo Yeah, but you cannot define it.
 
@daknøk why would it be impossible?
@Xeo the declaration is, but the function isn't. (Is it?)
 
Xeo
6:07 PM
auto puts = [](char const*) -> int{ return 42; };
:)
 
int puts(char const*) {return 3;}
namespace foo {
    void bar() {
        int puts(char const*);
        puts("Hello, world!"); // which one will it pick?
    }
}

namespace foo {
    int puts(char const*) {return 3;}
}
 
@daknøk You can definitely define the function ::foo::puts.
 
Xeo
@MooingDuck Err, there is no function inside foo (neither declaration nor definition)
 
@Xeo There is a definition for bar, and there is a declaration for puts.
 
Xeo
Ah, I see what you're discussing now :P
 
6:08 PM
@R.MartinhoFernandes Ah. So the function bar would not introduce an extra scope for function declarations?
Since you cannot do this:
void bar() {
    int puts(char const*) {
        do_something();
    }
}
 
@MooingDuck Assuming you included <cstdlib>, the rules are rather different, because puts will be declared as extern "C": "Two declarations for a function with C language linkage with the same function name (ignoring the namespace names that qualify it) that appear in different namespace scopes refer to the same function." As such, even though it's inside a namespace, the inner declaration still refers to ::puts.
(and both your definitions will violate the ODR).
 
I'm looking for a music collection manager that does not suck. Any recommendations ?
 
lol C++’ scoping and name lookup rules span 19 pages in the Standard.
 
@kbok You'll probably have to write one. The best I've seen have still sucked pretty badly.
 
@kbok iTunes
 
6:16 PM
@daknøk ...and that's only the tip of the iceberg -- those 19 pages have lots of references to lots of other parts of the standard.
 
@JerryCoffin I have the feeling that everybody and their dog is writing their own collection manager. All of them sucks.
 
C++ scoping rules y u no simple.
 
@daknøk Good to see you have a sense of humor anyway.
2
 
@JerryCoffin I was not being sarcastic.
I never had any problems with iTunes.
 
@daknøk Don't push it. It stops being fun after a while.
 
6:17 PM
iTunes is excellent for benchmarking.
 
iTunes is good for producing biochemical weapons.
2
 
I don't understand how we can be streaming will.i.am songs from a robot on mars but still can't handle external drives in a music app.
 
@daknøk Dearly beloved, we are gathered here today, not to mourn the death of taste, but to wonder whether he ever had any taste at all...
 
@daknøk That's pretty much in any US licensed software
 
In that case… the US sucks.
 
6:20 PM
@daknøk It's not really the US, but lawyers -- but saying they suck would be redundant to common sense.
2
 
When it comes to name lookup and scoping, I love Python.
When it comes to name lookup and scoping, I love Python. FTFM
 
Also, scons or waf ?
 
Waf
 
Why ?
 
6:23 PM
Waf doesn’t require installation.
You put it in your distribution; it’s just one file.
And yes, before anybody tells me, it does require Python, but CMake also requires the C standard library. -.-
 
It's not even bootable?
 
cmake requires cmake..
 
I am going to write a C++ compiler for fun.
 
CMake is a requirequire...
 
CMake is a piece of shit.
 
6:25 PM
You mean, so that we can make fun of you ?
 
@kbok I’m just going to troll myself.
 
@daknøk The fun won't last long :P
 
It will abuse all edge-cases and ambiguities in the Standard.
 
So you're gonna implement Hell++?
 
for(;;); for example, will send SIGTERM to a random process…
 
6:26 PM
@StackedCrooked No, he won't. It's Hell++. The name applies both to its users and its developers.
 
make it format the disk and send spam everytime UB is invoked
 
Hey, it’s UB anyway.
Hell++ is actually PHP++.
 
@daknøk scons doesn't require an install either.
 
Not? Hmm
cool
 
PHP with macros and raw pointers. Let's do this.
4
 
6:30 PM
Face to a name we loath.
 
@Chimera What is this? Are you stalking him?
 
4chan-style
 
@R.MartinhoFernandes Not really
Don't worry, the new rifle scope I bought isn't for him.
What the hell is 4chan? I keep hearing about it.
 
> I mean, if only you could do simply have some kind of type system to distinguish what items each Processor can accept and then you could register those Processors with uh, uh, uh, a compiler, and then it would implement all the logic for you. A man can dream.
 
@Chimera The Internet's toilet.
 
6:32 PM
@Chimera A website.
 
@R.MartinhoFernandes LOL... Sewer even?
 
@Chimera it's the nesting and training grounds of the trolls.
 
@R.MartinhoFernandes A very apt description IMO
 
@MooingDuck Oh, nasty.
 
@Chimera originally designed as an easy way for artists to show each other pictures IIRC. It.... deviated.
 
6:34 PM
@MooingDuck Not even close.
 
@Chimera If you ever want to experience 4chan in it's most vile element, 4chan.org/b
 
isn't it traditionally expressed as /b/?
 
@Rapptz "Launched on October 1, 2003, its boards were originally used for the posting of pictures and discussion of manga and anime, as the site was modelled on Japanese imageboards." I wasn't all that far either.
 
@Drise Hey, after work. Wait, I can do it on my phone...
 
Either way
 
6:35 PM
@DeadMG /b/ is a subboard of 4chan, set aside for "other".
 
@DeadMG markdown lops it off
 
@MooingDuck I know that. But he liked to /b, not /b/.
 
@MooingDuck Barely.
/b/ is the random board. Many people who judge 4chan base it off that board.
 
ok, If I go there on my phone, will it give me herpes?
 
No. It honestly is not that bad.
 
6:36 PM
@Chimera don't risk it
 
@Rapptz It's the most popular one.
@Chimera No. The things it will give you eat herpes viruses for breakfast, so you'll become immune to herpes.
 
There's still a lot of porn there but the gore has lowered a bit.
 
Ok going to look now. Call an immunologist if I'm not back in a few minutes.
 
Coincidentally, there just happens to be one right now.
 
Why is my VS so sloooow all of a sudden?
 
6:39 PM
R# doing solution-wide analysis of a 100+ project solution?
 
@R.MartinhoFernandes I got, like, 15 projects.
 
I’ve been kindly asked to GTFO on programmers and not to discuss it to you guys have to suffer instead
I got this comment:
@KonradRudolph because to the persons in question (generically as opposed to spouses or equivalent) code isn't interesting - you need to give them something that's comprehensible in terms they can relate to. You can leave an opening for working towards code.. — Murph 11 hours ago
and I can’t understand how anybody – let alone five people, including those who upvoted – can think that way
it sounds utterly stupid
 
@KonradRudolph That's incredibly condescending.
 
I think it’s just a fucked up attitude
every liberal arts major will bore you hours on end his bullshit studies and yet that’s somehow socially acceptable
but explaining code? nooooo. That’s boring to other people, don’t do it. tell them you did accounting instead
 
@EtiennedeMartel I hate people that start from "the receiver is too stupid to understand my message".
 
6:52 PM
That's a very interesting question though
 
Plus, make it look simple will only make them believe it is simple.
 
I had a very hard time explaining that I wrote a brainfuck interpreter on my phone the other day
 
Muggles don't have any idea of the effort it takes to program.
 
Just gonna leave this here - stackoverflow.com/q/5166093/673730
 

« first day (690 days earlier)      last day (4254 days later) »