« first day (1130 days earlier)      last day (3827 days later) » 

2:00 AM
non-lambdas and lambdas are identical in this respect.
 
@DeadMG With lambdas there's an implicit auto. With non-lambdas there is none, and the idiom is to use decltype(auto) (the fact of that idiom is how we got into this discussion)
 
the feature has only just been implemented, at best.
it's a long time before we can safely call idioms.
I would certainly call auto idiomatic.
 
@DeadMG Usually the idiom is conceived at an early stage of language design, and the semantics are designed to make the idiom work.
 
far from always.
and the existing idioms in C++ have always been infer value by default.
 
@DeadMG Well… was your comment "Clang has had decltype(auto) since 3.3, apparently" referring to decltype(auto) per se, or function return type deduction since it is so closely associated with the former?
 
2:04 AM
Clang's cxxstatus page actually differentiates the two.
 
The idea is that one liner functions tend to be wrappers, and a wrapper should forward its return value, and decltype(auto) essentially provides such.
 
perhaps they meant decltype(auto) x = expr;.
 
8 mins ago, by Potatoswatter
decltype(auto) per se is a horrible toxic construct. Function return type deduction is the nice thing which it enables.
 
@Potatoswatter Fuck the idea.
what matters is that in C++, virtually everything, ever, deduces to a value by default.
people expect value by default.
a bunch of references that you didn't notice are going to destroy your program.
value by default is how it's always been, how it should be, and how it will be in the future.
 
@DeadMG Right… decltype(auto) can be used in many contexts, but due to hiding whether it resolves to reference or value semantics, it's pure evil.
 
2:06 AM
http://www.computercraft.info/

Found this cool mod for minecraft that teaches you programming by programming robots in the game.
 
@Potatoswatter Which is why it should most definitely not be idiomatic at all, and every use of it should be carefully considered.
anyway I'm off to bed, see you all tomorrow!
 
decltype((auto)) :D
 
@DeadMG Good night.
 
@DeadMG 'night
 
@Rapptz Now I'm fighting the urge to see if that's legal or not… thanks a lot. I think not because type-specifiers cannot be parenthesized.
 
2:09 AM
@Rapptz lol. Does the extra parentheses have an effect?
 
@MarkGarcia Yes.
 
@DeadMG Nites and may you dream value semantically.
 
@Potatoswatter Probably not.
 
@Rapptz Becomes a reference?
 
18
Q: decltype and parenthesis

FredOverflowI don't understand the last line of the example on page 148 of the FCD (§7.6.1.2/4): const int&& foo(); int i; struct A { double x; }; const A* a = new A(); decltype(foo()) x1 = i; // type is const int&& decltype(i) x2; // type is int decltype(a->x) x3; // type is double...

 
2:10 AM
@MarkGarcia No, just illegal syntax because the parens render the inside an expression, and auto is not an expression.
 
@MarkGarcia It was a tongue-in-cheek. It's definitely not valid though for decltype(auto).
 
decltype(auto) & would be a possibly legal act of sadism.
 
To be sure let's try it in some "conforming" compilers. :)
 
auto f(...) -> decltype(auto) { .. }
invalid right?
 
@Rapptz No, that's fine.
 
2:12 AM
lol
 
The ... maybe.
 
auto f() -> auto is similar.
 
the ... is actually valid syntax
 
@Rapptz Maybe in the future it's not. ;)
 
It's from C.
It's staying
and I hate it
 
2:13 AM
@Rapptz It's actually not, which is weird. C syntactically requires a parameter declaration before ....
 
so you can't have pure va_list? weird.
 
@Rapptz You can't get a va_list from f(...) anyway because va_start requires the name of the nonexistent preceding named parameter.
 
Wait.
 
ah right
 
2:15 AM
Damn it's GCC 4.8.1 in C++11 mode.
 
error: expected expression
    decltype((auto)) y = x;
                   ^
 
Wow, the compiler seems to be throwing a tantrum.
 
Man.
 
I can't believe VS2013 got decltype(auto) before GCC. :(
 
2:17 AM
@Rapptz I think GCC 4.8.2 already has it.
 
@Rapptz Well they just accepted the syntax at the parser level, or does it actually work correctly :P
 
-still patiently waiting for GCC 4.9.0-
 
Well, I'm wrong. 4.8.2 doesn't have it. :(
@Rapptz Same.
 
gcc 4.9.0 has it
it also has [[deprecated]]
 
I've pretty much just decided to keep my main project entirely C++11 until things are mature…
 
2:20 AM
GCC 4.9.0 has regex too.. ...which I have been wanting for a while :s
 
> Support for colorizing diagnostics emitted by GCC has been added.
:swoon:
 
the colours seem helpful tbh
 
Probably useless if you're using an IDE.
 
I might turn Portage output back on
 
@CatPlusPlus When was that? Since mid-October? I should pull from the repo again, cos I'm missing out.
 
2:26 AM
@Potatoswatter 4.9
I don't know which revision if that's what you're asking me
 
@CatPlusPlus 4.9 has existed for like a year :P
 
I'm just reading the notes
I don't use prerelease GCCs
Hell, I'm still hesitant to use 4.8 as my system compiler
 
4.8 is pretty good
 
Ah, just need export GCC_COLORS in my .profile :)
I've been on the bleeding edge for a while, and I've noticed nothing but bugfixes.
And I have a tendency to notice when things are awry :)
 
Historically GCC needed some time after major release to really stabilise
 
2:29 AM
@CatPlusPlus Breaking changes?
 
I don't know if that still holds, but it's GCC, and I don't trust their code quality :v Production systems can't break!
 
@CatPlusPlus True of all compilers… those days are over far as I can tell.
 
I haven't actually had any issues with my GCC 4.8.1
 
Once I contributed a patch with a bug, and the next day some minor microcontroller vendor in Europe reported that it broke their testsuite. I was given a day to fix it or say goodbye. (Fortunately it was minor.)
I think the improvement in stability is a direct result of market consolidation, where previously (up through the mid 2000's) such vendors and UNIX systems had different compilers now they're all testing the bleeding edge of GCC.
 
@Rapptz Yeah but did you compile most of your system with it :v
 
2:38 AM
I only compiled every library I use
so no
 
grrr sleep fail
 
Hrm.
I hate citations, I really do.
Want to ponder a question?
 
why not
 
Ok.
So there was this court case.
Now, I have this cited as the source for this in the references page, or whatever you want to call it.
But I am not positive how to go about the inline variant.
Saying "according to something, there was this supreme court case" feels wrong.
 
Wouldn't it be "Regents v. Bakke"?
 
2:49 AM
I am not certain what you mean.
 
What's the question?
 
court cases are typically referred to by the names of each side, possibly with a year and court if it's ambiguous.
so Regents v. Bakke is a fine way to refer to the cases.
 
The question is, how to do the inline citing.
 
that is the inline citing
 
that is the full inline citation.
 
2:51 AM
Normally, it is something along the lines of "according to so and so" and something like ("title", year) at the end of the paragraph.
 
you say, "According to Regents v. Bakke, XYZ is true".
 
I was thinking more of the existence of the case to begin with.
 
what about it?
 
Isn't there another famous racist/WASPish Bakke? It rings a bell…
 
@Potatoswatter another famous racist Bakke? This guy is neither famous nor racist.
 
2:54 AM
@DeadMG Fine then, isn't there one famous Bakke associated either with some racial issues, or generally culture exclusive of people of color.
 
I've never heard the name before today.
 
Bakke was a racist?
@DeadMG All I know is, I am expected to have some sort of inline quotation, but I wasn't sure if the same thing was appropriate here.
 
@Pawnguy7 The only citation you need inline is "Regents v. Bakke".
court cases are always referred to in such a fashion.
 
So no end-of-paragraph thing, you are saying?
 
nope.
maybe in the end-of-paper bibliography you can give the year and court as well.
if you really want.
 
2:58 AM
@Pawnguy7 The details of citations and footnotes are very specific to the venue, in your class the teacher's specific instructions. We can't really help you, just follow the instructions/examples.
 
Well.
7 mins ago, by Pawnguy7
Normally, it is something along the lines of "according to so and so" and something like ("title", year) at the end of the paragraph.
But that seems out of place here.
As the case isn't exactly general knowledge.
I need some reference to it.
Hence, database.
If there is a specific citation for court cases, I have no idea what it is.
I get stuck on such things for a long time, it seems.
 
@Pawnguy7 Anyone with a search engine can turn "Regents v Bakke, Supreme Court, 1977" into the case records.
 
@DeadMG I would argue that is true of many citations.
Do you get stuck on things like this?
 
@Pawnguy7 Sure it is. The supreme court ruling on affirmative action in education is about as general as American legal knowledge gets.
 
@Pawnguy7 Most citations are not court rulings.
 
3:05 AM
The Brown case?
 
@Pawnguy7 Are you stuck because you're not sure you're correctly following a strict format, or because you feel appropriate meaning hasn't been conveyed?
 
Anyway, I did not know of this case specifically.
Maybe I have the concept of general knowledge wrong.
It is certainly easily obtainable.
@DeadMG well yes, but it seems many citations are gray areas for some reason or another
@Potatoswatter The former.
Mostly because, there does not seem to be a strict one.
I mean, I could make assumptions.
But it seems this area is graded according to some sort of hidden rules :\
 
@Pawnguy7 Most just do that without thinking. Including perhaps your professor.
@Pawnguy7 Maybe he's just an asshole and hates you.
 
Might be.
Having been confused on many of these rules, I had asked him.
He told me to stop asking, and figure it out on my own.
Sad part is.
I am pretty sure my getting stuck on these citations has taken longer than actually writing the thing.
 
Wow. /cc @CatPlusPlus
 
3:11 AM
Maybe I need to make assumptions more often.
It seems oftentimes there is no black and white area to be found.
And it takes way too long.
 
But like.
This was the professor.
Who accepted a .docx three times.
Then docked me for it on the fourth.
Assumptions are dangerous :\
 
Sounds like an asshole. It's not like he's unaware that he's being capricious and arbitrary. Students complain about that sort of thing nonstop; there is generally awareness.
What format is more acceptable than .docx, anyway?
 
.doc :\
Oh.
One of the peer reviews was wierd.
 
Now that's just retarded. For the sake of argument though, he might do work on a few different machines and one has an ancient copy of Office.
 
3:17 AM
Might.
Still seems odd though.
So anyway, for this feedback thing.
They apparently (this was another student) took a .docx, and made it a .feedback.
@Jefffrey any snake progress?
 
@Pawnguy7 Noooope. You?
 
Depends when you saw it last I suppose.
 
@Jefffrey Did you just ask if his snake has made progress?
 
Did I tell you it audio?
 
@Pawnguy7 Has he seen your snake?
 
3:25 AM
@Potatoswatter Yes, I'm very interested in the status of his snake.
 
Mutual interest, I believe.
 
Especially the length/extension of it.
 
I got nothing :\
 
@Pawnguy7 Yup. Did you do something important today?
 
I'm supposed to work on stuff but I procrastinated.
 
3:32 AM
@Jefffrey absolutely not
 
@Rapptz Are you going to work on a snake clone as well?
 
Maybe.
 
Anyone know of a gentle, useful, and accurate intro to templates, available online?
 
try mine
 
I've seen two links to the cplusplus.com tutorial in the last week. Ech.
@DeadMG link?
 
Thanks, I'll pass that along… hmmm
 
@Jefffrey Uni project shit
 
I guess this is my problem with code too.
I am very bad at leaving things unresolved.
But I don't know how to resolve it.
So I endlessly tire myself until I don't care if it is bad, and I keep it.
@ScottW whois smooth?
 
I had started working on some OpenGL wrappers for projects of mine, and I thought I'd use it for a uni project. TA said we had to use VS2010 and so I had to "backport" the code I had. Its riddled with #ifdefs to turn enum classes into regular enums T_T
 
@Borgleader 2010 has enum classes, I think.
 
3:44 AM
> There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
 
oh no, wait, they have an extension to permit Enum::Enumerator even for non-enum classes, or something like that.
 
@DeadMG It failed to compile thats why I had to use the ifdef in the first place
 
What was the significance of 301+, again?
 
er, in what context?
 
youtube
 
3:45 AM
@Pawnguy7 the google view numbers, its on numberphile, look it up
 
oh, dunno.
 
There was an x.. whatever the webcomic was, I think.
 
xkcd
 
Yes, I always want to say xycd.
 
3:47 AM
I doubt I will ever get it straight.
 
It is... not very complicated
 
@CatPlusPlus It's a confusing name ok?
 
Well.
I don't know how you remember random consonants anyway.
But in addition to that.
I seem to have learned it the wrong way.
Which makes it worse.
 
Honestly 4 letters isn't that hard to remember, unless you're dyslexic or something
 
Not that I know of.
They just...
Don't bear resemblance to a word.
 
3:52 AM
@Borgleader I must sydlexic then
 
But hey.
Oct 25 at 17:51, by Pawnguy7
I think there was an xydc once.
I said it then, and they knew what I meant.
 
@Borgleader 5:31, he uses goto.
The odd thing was, it was completely unnecessary and made it a bit more confusing given the flow of the previous statement.
 
I think it makes less sense than it did before.
Which is a feat in itself :D
 
@Pawnguy7 Every word is random consonants and vowels
How do you remember words
 
Any recommendations for a programmer with substantial background in ANSI C, C# and Java but just starting out C++? If you could recommend any good books (hopefully not too basic, like showing what an if statement does) or let me know of any particular gotchas I need to watch out for in C++, I'd really appreciate that.
 
4:01 AM
@l46kok What sort of field? Systems, GUI apps, scientific?
 
C++ Primer 5th ed is pretty good
 
Right now, I'm just learning as a hobby, but I've done embedded system programming in C and GUI/Web Programming in C#
so either recommendation would be ok
 
Hm..
 
Main advice I'd give is to make a goal of removing all pointers (explicit dynamic allocations especially) and minimizing typecasts. C++ does provide those things, but they are usually last resorts.
 
@l46kok Forget everything you know about C
 
4:04 AM
woah.. that's pretty extreme
how is dynamic memory allocation typically done in C++ then? I was under the impression new keyword is used quite often
 
@l46kok Use container classes instead, or smart pointers (which are like containers for single objects)
 
Also embedded C is even more horrible than usual C, so double forget it
 
new is just a memory leak waiting to happen, considering how exceptions can override control flow.
 
@l46kok It is use very often, but they're usually done uninformed, and they cannot give a good reason why they almost always do.
 
4:07 AM
@CatPlusPlus That's not fair, it's just that programmers who stick to embedded as a personal niche gain years of experience without ever touching a project >1000 LOC.
 
It's horrible crap
 
so in other words, don't do dynamic memory allocation unless if you have a very good reason of doing it ok
 
@l46kok Don't do it unless you're following the rough pattern of a container class: every new should match a delete, and the ultimate delete should be in a destructor.
 
At the least, always wrap anything that does dynamic allocation. Use RAII. Same for other resources that you don't want to leak.
 
Don't say delete, unless your class is a resource primitive
Rule of zero
(Don't say new either, use make_*)
 
4:10 AM
make is C++ equivalent of factory pattern from Java/C#?
 
@CatPlusPlus Well, the implication of that is there is a class with delete in its destructor :P
 
Don't say pattern
 
@l46kok There is not function named make, it's just conventional to name factory functions with make_*.
 
ah ok
 
Are they really factory functions?
They're just there to deduce the type for template classes. Does that constitute as a factory function?
 
4:11 AM
C++ factory function = function returning class type by value.
 
Everything that creates something is a factory
Also obligatory fuck design patterns
 
Usually when I think "factory" I think of the "factory pattern" which is different imo
 
No, it's not
 
Don't do explicit releases/unregisters and all those kinds of stuff. Again, use RAII.
 
The retarded Java-centric formulation of the ~~pattern~~ is different
But only slightly
In that it focuses on what should be a stateful factory usually
 
4:14 AM
Java comes from the mindset that you need more boilerplate to be more correct, a mentality that pervades all education in certain cultures.
 
I consider make_shared and the likes as something like "adapted constructors".
 
Yeah I've never considered them factories.
 
It creates a thing. It's a factory
 
Which basically returns the same resource as class constructors, only that they do some tweaking (like in make_shared optimizing storage).
 
We don't usually have stateful factory objects/classes at all. You would treat such a class as a data-centric container, not a task-centric factory.
 
4:16 AM
Are constructors factories because they create a thing?
 
You would have a data container class with a factory function returning by value, but it wouldn't be a factory class per se.
 
Constructors don't create things, they initialise them
 
True.
 
@Potatoswatter Only the factory methods are. Right.
 
I still don't consider it a factory because a factory is an object that produces an object, not a free forming function.
 
4:17 AM
Why is it an object
 
It feels if it's applied to functions then any functions that returns something is considered a factory.
 
If creation involves steps besides initialization, then you need a factory function, ideally with special friend access. However, generic factories like make_shared are not available to befriend, which is a language defect IMO.
 
@CatPlusPlus It's how I learned the pattern.
 
That's the problem with patterns
cargoculting dot txt
 
In object-oriented computer programming, a factory is an object for creating other objects. It is an abstraction of a constructor, and can be used to implement various allocation schemes. For example, using this definition, singletons implemented by the singleton pattern are formal factories. A factory object typically has a method for every kind of object it is capable of creating. These methods optionally accept parameters defining how the object is created, and then return the created object. Factory objects are used in situations where getting hold of an object of a particular kind...
 
4:19 AM
It's idiotic formulation that focuses on wrong things, and exists for wrong reasons
 
@Rapptz Is there a language or environment besides Java that actually uses such a thing?
 
Like most ~~patterns~~~
 
make_shared doesn't need to store state, so it need not be in an object. Can still be considered a factory though.
 
@Potatoswatter Says C#, PHP and VB.NET in the other article
 
@CatPlusPlus Your pattern is wrong. You're missing a ~ on the left side.
 
4:20 AM
Ugh
Fuck whoever wrote that fucking book
It's a brain disease
 
Better fuck that girl in the cover of the other patterns book. :P
10
 
oh yeah what compiler should I use or does it matter at all
i heard VS 2012's C++ 11 is incomplete
and i heard a lot of recommendations for gcc
 
@l46kok lol
 
MSVC's everything is incomplete
 
@Potatoswatter I used that today. In C++.
 
4:28 AM
@EtiennedeMartel As opposed to a separate container or allocator?
 
@l46kok Have you tried LLVM?
5
 
@MarkGarcia Clang. LLVM names the umbrella project and framework.
 
no, any particular reasons you'd recommend it over other compilers?
 
@Potatoswatter That how the clang guys said it in GoingNative. :P
@l46kok Some say it's overrated (I also think it somehow is), but they say it has faster compile times and all.
 
@MarkGarcia Weird. Originally LLVM was supposed to be a reusable, all-purpose compiler framework. Given that goal they should want to encourage a distinction versus the most popular application(s) of the framework.
@MarkGarcia Beats me. It won't compile my project at all. Compile times aren't really an issue for a beginner… just go with whichever installs more easily on your system. IOW, try both.
 
4:34 AM
@Potatoswatter Actually originally a virtual machine. And the LLVM guys hate that, and dumped the acronym LLVM's original meaning.
 
@MarkGarcia The VM was part of the framework, back when Java PR had everyone believing that JITs would kill everything.
 
@Potatoswatter MSVC sticks out and violently waves his hand. :)
 
But it was no more integral to everything else than any other part. The statically targeted compiler uses the same CFG classes as the JIT.
@MarkGarcia Yeah, except it continues not to have a real template engine.
 
It's like Kawasaki saying "buy our sedan, it has a 150 HP 2-stroke engine!"
 
4:47 AM
testing time of the app development, when I always manage to piss myself by finding more bugs after fixing
 
so, friendship doesn't propagate up OR down?
 
@Borgleader venturebeat.com/2013/11/18/… source is "Xbox’s general manager for accessories," so they probably do this research in the course of covering all markets including arcades.
@caps Friendship propagates nowhere.
Whether it even propagates inward, into all scopes inside class { } is controversial.
 
@Potatoswatter Not controversial- fixed in C++11.
 
@DeadMG Reference? I've filed a DR within the last few months.
 
none, all I remember is that it used to be that friendship did not apply equally to all members, and now it does.
or should do.
anyway, I'm off to attempt sleep again.
 
4:54 AM
@DeadMG There are scopes besides members. I'm referring to whether friendship extends to friends defined inline with the class.
 
5:14 AM
@Potatoswatter Thx
 

« first day (1130 days earlier)      last day (3827 days later) »