« first day (1564 days earlier)      last day (3367 days later) » 

user1804599
11:00 AM
#include <string>
#include <iostream>
using namespace std;
int main() {
    std:string s("hi");
    cout << s << '\n';
    return 0;
}
 
I know you're not supposed to mess with the std:: name space, but I want to add make_unique in a c++11 project. Should I add make_unique to the std namespace?
 
no.
that just guarantees that when somebody compiles it as C++14 it will break.
 
i was hoping i could ifdef it out
 
yes
^ for giggles
 
11:02 AM
it's officially undefined behaviour to add your own stuff to std.
 
if the code was compiled with -std=c++14 or whatever
 
@Pris Just create one and don't add it into std name space.
 
there's no point in putting it in std.
 
Don't people add stuff to std { } for swap though?
 
no.
also there are some things it is legal to add to std but overloads/plain new functions is not one of them.
 
11:03 AM
@Pris No. They use using std::swap; in their functions.
 
No you may overload stuff like hash/less/etc but not add your own
 
that is not an overload, it is a specialization which is a totally different thing.
 
You are correct and you win +2 internet points
 
@рытфолд one of my most common typos
 
Damnit. Now my code will have... std::make_shared, but 'just' make_unique. How awful
 
11:04 AM
I already have all the Internet points I need.
@Pris You don't have a pris library?
practically every Lounger has their own personal cross-project support library with stuff like that in it.
 
cough rightfold cough
 
yeah its called 'ks', but then: std::make_shared, ks::make_unique ewww
 
it's fine.
 
//If you're #ifdefing, might as well do as follows.
namespace my {
#if __cplusplus > 201400L
    using std::make_unique;
#else
    void whatever_your_make_unique() {}
#endif
}
 
I have no personal support library. I sucks
 
11:06 AM
namespace STD { ... }
 
I have one but since I only have one project of note it's just kept tightly coupled there :P
 
I could... put "using std::make_shared;" in my name space. Then, ks::make_shared, ks::make_unique
 
@R.MartinhoFernandes :msvc:
 
@R.MartinhoFernandes yeah
 
Even though I walk through the valley of the shadow of death with zero internet points, I will fear no evil, for you are with me; your rod and your staff, they comfort me
Psalm 23:4 sounds very 50 shades of greyish
'your rod & your staff, comfort me' - while gagged?
 
11:08 AM
What's the __cplusplus value for C++14/ISO/IEC 14882:2015?
 
Around fifteen
 
@Pris namespace home { using std::make_shared; /* define make_unique */ } and now you can use home::* if consistency is your pet peeve.
@Pris Yes, that.
 
I wonder if any projects have single letter namespaces
x::files;
 
Time to go home clis
 
11:13 AM
@R.MartinhoFernandes Draft N4296 says 201402L
 
😁::shared_ptr<😁::vector<int>>
reminds me of the time i got some c++ driver source code for a motor made in china
 
Dr. Loring ain't gonna tap that cos he knows it's a sin
ba dum tschh
 
user1804599
@AndyProwl you can do it once per function.
 
@Sehe: Seriously? My point was made at my first post! But for the benefit of those who lack the experience to understand what finally brings to the table: deterministic reversible state changes. For example, something you might commonly see in Delphi code would be a dataset object with controls bound to it, and when you go to load data into it, it looks like this: dataset.DisableControls(); try loadData(dataset); finally dataset.EnableControls(); end;Mason Wheeler 2 mins ago
You can invariably recognize the best of debaters by the frequency in which they use "Seriously?" to suggest a killer argument that's not actually that strong, or simply absent
 
11:24 AM
lovely, the app SIGABRTs on Android when assigning something to boost::function
other platforms work ok
I'll just use function pointers like the others and call it a day
 
@AlexM. what the hell
@AlexM. also why not just use std::function?
 
because std::function is absent in C++03
 
android toolchain has c++11 support
 
as if I make the decisions regarding who uses what
 
I think the example given is particularly weak. Imperative code. Side-effects. Separation of concerns (make the controls observe the dataset?). Mutable state should be governed elsewhere. (Regardless, in modern C++ a SCOPE_EXIT or similar generic tiny RAII helper can achieve exactly the same)sehe 26 secs ago
 
11:29 AM
@AlexM. TR1?
 
@AlexM. ... cant you just tell your boss or whatever to use gcc 4.8 or whatever? hell you can even use clang if there are licensing issues
 
GCC and Clang are compilers; std::function is a library.
 
okay, then gnu stl or whatever other flags you pass to your android make file
 
@Pris the issue is that there are too many game teams in the world
using different tools
you'd have to make the change at a global scale or it's a no go
 
@AlexM. Better: just debug and fix boost::function.
or roll your own obviously-correct boost::function.
just because that one specific implementation is not reliable does not mean that you should go back to a terrrrrrible interface.
 
11:32 AM
@AlexM. does that mean you guys are using your own special c++ standard library or something? i fail to see how there's any other reason for not using std::function
 
@Pris not everyone uses C++11 compilers
 
@Pris Because his customers don't have the necessary compilers.
 
how do you fail to see that
@Puppy well yeah :(
but I'm not sure how long that would take me
 
not long.
boost::function is fairly simple really.
 
sorry, i was just focusing on the 'android' bit
 
11:33 AM
the worst part is specializing for various arities.
you could crack that out with Boost.Preprocessor though if you want.
 
@Puppy Er, why that before debugging his own code?
Horses first.
 
@R.MartinhoFernandes I assumed that he had already done that.
instead of randomly blaming Boost for failing if his code corrupted the memory of the function object or something.
 
@Puppy No, it is not. :)
 
@wilx It really is. It's just a bit of type erasure with SBO.
 
By the way, can't you just re-implement several select parts of the C++11 standard library by just using Boost?
On non C++11 compilers?
 
11:35 AM
he is already using Boost.
 
No but you can right?
 
#ifdef ANDROID // use std::function #else // use boost::function
 
strictly they're not really the same; but quite similar in most respects.
there's no tremendous harm in using boost::shared_ptr over std::shared_ptr
 
@Pris Just use Java.
 
By the way, do you think Boost.Python is the ideal C++ binding for C++/Python?
I know that Lua has like a million but IDK about Python and I couldn't find a good SO answer
 
11:38 AM
lol ideal C++ binding
oh so that's why you're here, huh
off-site resource; off-topic; closed.
 
'tis true.
 
@Jerry btw, Java 7 has the same mechanism as C#'s using.
 
@R.MartinhoFernandes ooooh, that gave me an idea
 
so you didn't debug your own code before blaming Boost?
 
11:41 AM
there ain't much to debug in a single assignment
gimme two secs
 
@AlexM. Only the entire program memory state prior to the assignment.
 
it works
why the hell did it fail only on android
let us never speak of this again, please
 
ub
 
12:02 PM
@Griwes re. Linked J.Kalb vid:
> Interesting talk but honestly fuck off with the Star Wars quotes
lol
 
@sehe Link, please.
 
the force is low in this one
 
@sehe These are not the Star Wars quotes you're looking for?
3
 
Great going on editing in your opinion on Wikipedia: en.wikipedia.org/w/…rubenvb just now
The guy edited wiki to make a point
 
@jalf :D
@MasonWheeler You might want to learn the most important principle of exception handling in C++: there is no try. It's not even about finally itself - seeing try a lot in code makes me reconsider my opinion on whoever wrote it pretty quickly. — Griwes 35 mins ago
 
Am I the only one that sees these functions don't actually return an int? — rubenvb 5 secs ago
This question is spawning hell on earth.
 
@rubenvb lol
> The first is that it requires the use of stack based objects, which are an abomination that violate the Liskov Substitution Principle
 
wait, these functions do return. I missed that somehow
 
48.3k
 
12:15 PM
Or the little details that you learn to avoid because your language doesn't suck. Oh no. Can't claim that for C++. (It sucks eggs, for many other reasons, beyond your claim). But you get the point (programs don't suck less because you add more (fire-proof!) (industrial-strength!) (code-review-approved!) band-aid though) — sehe 1 min ago
 
And I'm here enjoying the time when I actually get to do some C++
 
> The first is that it requires the use of stack based objects, which are an abomination that violate the Liskov Substitution Principle
wat
 
> when all you have is a hammer, everything starts to look like a destructor, so to speak
 
@rubenvb We noticed:)
 
it's full of juicy wisdom
 
12:17 PM
@MartinJames I got rid of the comment quickly :p
In my defence, I had two tabs open showing two different answers and my brain mixed them together.
 
@rubenvb Sometimes the brain does some buggy parsing... :p
 
> How would this be done in C++? Well, first you would have to code up an entire class
so... much... typing
 
he must hate Java
and C#
 
@jalf wat?!
 
@AlexM. Who doesn't? trolls
 
12:21 PM
@sehe I missed that bit too. TL;DR :P
 
I'm neutral towards Java
 
-3
A: Is the 'finally' portion of a 'try ... catch ... finally' construct even necessary?

Mason WheelerLike so many other unusual things about the C++ language, the lack of a try/finally construct is a design flaw, if you can even call it that in a language that frequently appears to not have had any actual design work done at all. RAII (the use of scope-based deterministic destructor invocation ...

 
@sehe Eggs sucking is overrated. Unless you mean like chicken eggs, in that case, eww.
 
I don't have a casus belli
not sure I'll ever hate C#
it's been my bff for 6 or 7 years now
we love each other <3
 
I feel the need for destructors when doing some Java
 
12:23 PM
In other news
72
A: How do I set environment variables from Java?

pushyFor use in scenarios where you need to set specific environment values for unit tests, you might find the following hack useful. It will change the environment variables throughout the JVM (so make sure you reset any changes after your test), but will not alter your system environment. I found t...

@Rerito In fact, you feel the need for determinism, rather :/
 
And by the way, doesn't the finally question belong on SO proper?
 
no
 
Why is that?
 
It's not solving a concrete programming task with existing code in a particular language
 
@sehe That's another way of putting it indeed. Though my current C++ knowledge isn't broad enough to claim it that way
 
12:24 PM
@rubenvb well it's language-agnostic and there were many similar question on P.SE
 
@Abyx Hmm, ok then. I guess "programmers" is like the bin of SO.
 
sort of
 
often seems that wasy
 
@sehe Evironment variables? Who cares, they're globals - I don't use them.
 
finally somebody else with a gram of sense about env vars
> Invalid letter date - date cannot be in the future
lol
 
user1804599
12:39 PM
@sehe dat loop
 
user1804599
why not just Class.forName("java.util.Collections$UnmodifiableMap")?
 
user1804599
scala> Class.forName("java.util.Collections$UnmodifiableMap")
res0: Class[_] = class java.util.Collections$UnmodifiableMap
 
user1804599
Works fine.
 
@MartinJames except you have to whenlaunching external programs :0
 
@sehe Oh.. you mean because the external programs use environment vars?
 
12:45 PM
YAAAY FUCKING YAY ENDED THIS FREE FROM UNI FOR HALF A YEAR
 
user1804599
:(
 
Fuck you UML
And fuck you enterprise architect
Fuck OOP too
 
lol school
 
@BartekBanachewicz You were paroled? Why?
 
And archhitects, for good measure
 
user1804599
12:47 PM
Fuck you.
 
@MartinJames today was the last day of classes on this sem
 
somewhat relevant (or not)
Sounds like academic software. — Dave Clarke Jan 22 at 21:30
 
@BartekBanachewicz \o/
 
Sohappy
Now i need 10hrs of lessons more and on for a driver's licence
 
@sehe lol
 
12:50 PM
I ought to go shopping. I can't spend all day trolling the 'try-finally' question.
I want some pork steaks.
 
Does anyone know if accumulate/all_of/any_of/none_of/.. are just fold + pred + value in haskell ?
 
OK, Haskell. Where's my shopping bag?
 
gonna subclass exception some days and use fruits as extension names, so for smaller problems I would be throwing tomatoes & like, for bigger ones I will be throwing watermelons & durians
 
new york looks like such a lovely place to spend a week in
all those tall buildings and stores
 
@gnzlbg why don't you check yourself
 

« first day (1564 days earlier)      last day (3367 days later) »