« first day (1562 days earlier)      last day (3388 days later) » 

6:11 AM
@Rapptz I’ve tried, well, emulating it but I only like it for make_unique. Makes the interface complicated though and tricky to remember. These days I’d be more inclined to define parameter objects, and overload. Or even use a different name (e.g. foo(args…) by default, foo_with(options { blah }, more_options { blah }, args…) for more features).
 
I'm doing parameter objects atm
designated init would be helpful lol
 
Xeo
yawn
 
of all C99 features
Why not that one? ._.
 
Xeo
yay, my headache is gone
@Rapptz Because we have constructors or something!
Yes, designated initialisers would be awesome
 
but..?
 
6:13 AM
I also don’t mind defining enums/constants to obviate the need for booleans.
 
Xeo
@LucDanton I'd really like some sort of "function-scoped" enums - that is, you basically define them only for the arguments, and the enumerators are only available when calling the function (or inside the function)
without the need for extra scoping
 
[[bitflag]] would be good
automatically overloads operators for enum classes.
 
@Xeo Lisp-style is to use symbols, which I suppose is not far from Python’s (and Lua’s) ways of stringing it up. OCaml lets you define variant tags on the fly (e.g. display_box: [`Blue | `Red | `RGB of (int * int * int)] -> unit), although it does have labeled arguments proper.
 
Xeo
The important part for me is that those enumerators don't need extra qualification, and are not available outside the function
 
Who does (): unit really!
@Xeo What if another function defines its own with the same names?
 
Xeo
6:22 AM
@LucDanton That wouldn't be a problem, because they're only available when that function is called
(I'm probably overlooking stuff like binding, saving arguments of those types, function pointers, etc)
 
Practically speaking, that’s the same deal as OCaml’s variants.
 
Xeo
@LucDanton Sounds like it.
 
and you can attach data to the tag as a bonus
void display_box(tagged_variant<struct blue, struct red>);
^or, how to lose track of scopes and face obscure linker errors
@Rapptz Abuse of attributes!
 
Sure and Haskell and Rust derive stuff, too.
 
6:33 AM
GOT A BETTER SOLUTION BUB?
 
If you don’t want to go the pseudo-mixin way (understandable), suck it up and go struct my_flag_type { unsigned value; }; with no operators.
'Better' meaning 'worse' here, because worse is better.
 
Xeo
@LucDanton aww
 
@Rapptz I actually don’t like the phrase 'suck it up' though. So I am sorry.
 
It's okay.
foo(foo_options().option_one(10).option_two(true)); // terrible
 
@Xeo I know, such shameful hackery should be rewarded by linker UB!
@Rapptz If you can afford to go UDL it’s hilarious lol.
slice(0_from.to(4)); // wait, what?
 
6:39 AM
I saw foo("shit"_kw=10)
in the wild
 
Meaning runtime-checks? That’s the lowest of the low.
 
Xeo
@LucDanton Sometimes, I wonder if UDLs are actually worth it. I mean, it's one character more for from(0).to(4)...
 
More seriously I think I use from(0).to(4) has a less terrible alternative to slice_options().from(0).to(4) (to reuse your example).
 
I have a big integer class
you can construct it with 12938210309_x
 
6:41 AM
@Rapptz Oh I thought kw was a metavariable for the, well, actual keyword and that two parameters were sent in.
I mean it’s reserved and all! (Even though you diligently fixed that, huh.)
@Rapptz What the fuck
 
enjoyable eh?
 
I forgot that I do not normally read C++ blogs.
 
It gets worse the more you scroll down
I found this through google while looking up how people do it.
It'd be insulting to say I read this blog normally.
 
Xeo
Aww, the LWS link is dead
 
good ol' LWS.
I had some bookmarks there for snippets of code I might have enjoyed
shame they're dead
 
6:46 AM
@Rapptz I meant almost any blog. I left the loophole in because I do read Eric Niebler’s (which has its fair share of crock, too).
 
@Rapptz User defined literals?
 
Xeo
> We subclass std::map and add get() semantics to be a bit more Pythonic.
holy what
 
@Mysticial yup
 
I also used to cpp-next, RIP.
 
@Xeo wut
 
6:47 AM
told ya it gets worse!
 
Xeo
Does it get even worse?
I mean, the any-like hierarchy + shared_ptr already came across as "waaaait a second"
 
Sadly my defensive mechanisms were too late in shielding me from the stupid, I was midway through 'hey we don’t need that virtual destructor here' when it kicked in.
 
lol
I almost feel bad linking it
 
@Rapptz I have like 3 different BigInteger classes. None of them can take literals or even strings as constructors.
 
@Mysticial Must suck.
 
6:50 AM
@Rapptz It only needed a NSFSanity tag or similar.
 
@Rapptz Yeah, they aren't very user friendly.
At best they have a constructor or a setter that sets it to a 32 or 64-bit integer.
The majority of them are constructed by pointer and length.
 
@LucDanton It'd be worth considering but then there's things like foo(from(0)) which doesn't make much sense I imagine. Or when you need foo(to(10)).
 
@Mysticial Oh, I thought there was nothing of the sort at all when you said 'no strings'. Well, pointer to what though?
 
probably pointer to ints
 
Oh I see what I did, (yeah, it's been a while). For each datatype, I have 3 classes. One with standard RAII ownership, one with no ownership, and parent class that holds all non-mutating methods to reduce code duplication.
 
6:53 AM
@Rapptz Makes as much sense as foo[0::].
 
Well I meant for a hypothetical scenario :)
where there are default parameters
 
(and yeah there’s a to, for Yoda.)
 
@Rapptz Yeah, pointers to 32-bit or 64-bit integers.
 
Oh okay that’s different.
 
Looking at my code, I have 4 large number types:
- BasicInt
- ExactFloat
- GenericFloat
- SwapFloat
 
6:55 AM
@Rapptz In my case there parameters are here just for building slices. It’s not used elsewhere.
 
main.cpp:12:23: sorry, unimplemented: non-trivial designated initializers not supported
 
The problem with making a truly user-friendly large number type, is that you need a base conversion in implement base 10 string conversions.
And that requires division and modulus which are not trivial.
 
I can't even fantasize how it would be like.
 
What?
 
designated init
 
7:05 AM
oh
 
I'm not satisfied with anything
None of this seems good
I don't want to be that one idiot who makes an entire class to do one thing that could be done with a free function.
 
Does the member-as-base idiom count?
 
No
 
7:25 AM
@Rapptz depends on how much that functionality would be re-used
 
7:39 AM
Oh My God
I guessed on a Closed Form for this one, and it worked ;___;!
 
@Rapptz I don’t think you’re at risk.
 
Xeo
Sigh. I hate it when enemies appear right under me in Bindings of Isaac, and I get no chance to dodge them. FFS.
 
8:07 AM
my enemy's enemy is my ally
 
8:43 AM
I need a new monitor ...
 
8:58 AM
Great. i see that wintermute was here. And leftfoldancock first called him Vlad, then started rambling about Perl
 
9:47 AM
Here's me building MS's C++AMP examples project thingie downloaded through VS... Build failed because they used using namespace std; using namespace concurrency and then used array which is in both namespaces...
And they use both cout and wcout.
Fuck this example code.
 
template <typename ... Interfaces>
class __declspec(novtable) Implements : public Interfaces ...
{
};
Well. You learn something new every day.
Or in the case of C++, an arbitrarily large number of things.
 
:D
 
Xeo
> without any language extensions
> class __declspec(novtable) Implements
erm
 
lol..
 
10:27 AM
what's the purpose of that class anyway
class C : public X, public Y, public Z
// to
class C : public Implements<X,Y,Z>
 
Xeo
@BartekBanachewicz Hiding boilerplate
 
yeah seems like it
not a bad idea actually
but having multiple interfaces lol
 
@Rapptz um, that's perfectly reasonable?
a tad less useful with closed interfaces, but still
 
10:46 AM
Hmm, I have yet to find an AMP example that actually works...
 
@rubenvb uhhhh... use the parallel foreach, feed an amp(restrict)ed lambda and you're good to go; set up input and output concurrency::arrays and syncrhonize or vectors should sync themselves; fin
 
@ScarletAmaranth yeah, well, I was just looking for some samples, but guess writing the code myself will indeed be a faster way to get started... So much for great MS documentation (with respect to functional samples)
 
@rubenvb give me a moment, I'll write something
 
@ScarletAmaranth thanks!
 
11:02 AM
sure
 
 
1 hour later…
12:13 PM
Has the Lounge died? Am I alone on the planet? Is my time over? Am I going to have to buy my own beer in London?
 
user1804599
Yes. Yes. Yes. Yes.
 
some people do not have principles ... as long as it benefits them, they will just cave in and indulge others in their wrongful behaviour - King Abdullah is a reformer, really? Women in his kingdom still can not vote or drive. It's probably not appropriate to diss a recently deceased person, but it really shows the true nature of some so called 'world leaders'
 
@chmod711telkitty Reform comes in many shapes and sizes.
 
to avoid changes altogether is impossible
 
Relative to what that region has seen in recent times, he is in the positive end of the ballpark.
But the ballpark in quite large, I fully agree with that.
 
12:23 PM
morning
@MartinJames Sick last night :(
 
@Puppy I've been 'off' for a couple weeks. Some stupid virus. Mostly recovered, but painful cold sore on upper lip:(
 
a bunch of you seem sick
 
@MartinJames Beer alone is better than no beer at all :)
 
@MartinJames I face the somewhat more serious issue of my pills no longer being as effective as they once were.
 
@StackedCrooked Marginally, yes.
 
12:27 PM
I am fine ... despite sore hands from building my tiny house
 
@Puppy Oh:( Mebbe there is some alternative formulation.
 
more likely they will simply increase the dose
I'm on a tiny dose right now
 
I wake up every morning with painful joints
 
Orite:)
 
@Puppy That's a normal thing for some kinds of medication. They decrease in effectivity until a stable point is reached.
At this point they still work though.
 
12:30 PM
@StackedCrooked Yes, but it's not normal for this paticular one.
 
user1804599
nothing works
 
@рытфолд better fix your code then
 
user1804599
I'm voting to close this question as off-topic because it is pure speculation. — рытфолд 10 secs ago
 
user1804599
They got rid of the "This question appears to be off-topic because it is about" message. :(
 
@Puppy more asbestos!
 
user1804599
12:34 PM
I'm voting to close this question as off-topic because this is not a gimme teh codez website. — рытфолд 6 secs ago
 
user1804599
Right, it's Homework Sunday again.
 
@MartinJames If you were the last person on Earth, you would have to brew your own beer.
 
user1804599
No.
 
user1804599
You can still get existing beer.
 
user1804599
Until you run out of it.
 
12:38 PM
@FredOverflow That's bad. I tried brewing myself once. It didn't end well.
 
@thecoshman am-i-trippy-line
 
are empty structs/classes that are solely there to inherit from a code smell
 
there's no point in inheriting from an empty struct.
 
user1804599
MGS5 y u no release date.
 
There are two women who I admire - Angela Merkel & Julia Gillard, there is one I despise - head of IMF Christine Lagarde. At one stage she kept on talking about how the Australian economy was going to crash - it didn't & it has been 3+ years. Then she praised Saudi king for being a feminist. Not to mention her alleged misuse of power.
 
12:42 PM
@рытфолд i was watching a play through of a ps1 game and it had the words 'the phantom pain' in it... i wonder if kojima got the name from there
 
I imagine that the words of most game titles have already been spoken somewhere, somewhen.
 
@Puppy it lets you pass something through another class without that class having to know said type
 
@Pris Which is useless because whoever's on the other side can do jack shit with it.
(also templates/boost::any)
 
user1804599
@Pris I don't.
 
what if the type is definitively known by the receiver? Class A passes empty struct B to class C. Class C later passes it to class A
 
user1804599
12:46 PM
@Pris Probably because Snake has a prosthetic arm!
 
Hey guys.
Good morning.
 
Like if IMF needs a CEO, at least choose one from finance ministers/treasurers of countries that did not affect that badly by the GFC?
 
@рытфолд snakes don't have arms, you silly
 
user1804599
Good thing Snake isn't a snake.
 
that sounds deep
 
12:49 PM
sigh... upgrading to ssd held up due to watching a video... it'll happen at some stage :S
 
user1804599
@StackedCrooked Snake eats snakes.
 
Am I the only one finding this hilarious?
the monster supposed to be hunting the girl but is actually looking at the camera it seems
 
@Pris You pass to what
 
@chmod711telkitty Real or movie? ;)
 
for a photo to be posted on its facebook page titled 'people whom I eat'
@FredOverflow movie I assume
 
12:58 PM
@milleniumbug full story: I have a 'Renderable' class. It has some functions exclusively called by the render thread, like "Render()". But the Renderable gets updates outside of the render thread, maybe to change a 'color' property or something. I post this update to the render thread as a callback (all changes must occur on the render thread) by passing it a copy of an empty "Data" struct that a concrete implementation of 'Renderable' must implement.
But the empty Data struct seems... bad.
 
pass std::function<void()> problem solved
 
user1804599
don't have a Renderable class.
 
also dedicated render thread -> super bad.
 
user1804599
Make render a free function and use overloading and ADL.
 
user1804599
Then use a private class template with a virtual method to call it.
 
1:01 PM
@рытфолд ADL? @Puppy why is a dedicated render thread a bad idea?
@Puppy std::function seems like a good idea
 
Or use SFINAE. Lots of SFINAE. You can never have enough SFINAE.
 
because
 
SFINAE = So Fred Is Now An Expert?
 
you're assuming that the rendering is exactly 1 thread's worth of work.
if it's more expensive or cheaper, you're wasting time.
and furthermore
 
user1804599
void render(RenderContext& ctx, Zombie const& zombie) { … }
void render(RenderContext& ctx, Gun const& gun) { … }

void render(RenderContext& ctx, Scene const& scene) {
    for (auto&& zombie : scene.zombies) render(ctx, zombie);
    for (auto&& gun : scene.guns) render(ctx, gun);
}
 
1:03 PM
it involves a bunch of complex synchronization with other threads that are changing states.
 
I like that ? at the end
 
user1804599
no need for silly classes
 
it's better to perform rendering then simulating/etc in serial, but have each one (rendering, simulating, etc) be in parallel.
@рытфолд That does not permit adding new scene object types after the fact, though.
 
user1804599
Then you can do this:
 
@Puppy a dedicated render thread makes sense because I know that I can't get away with everything in a single thread. I hate threads, wouldn't use them unless I had to
 
1:05 PM
@Pris No, that's a reason to use parallelism, not a reason for this particular parallelism design.
 
@chmod711telkitty yes
 
what particular parallelism design? a separate render thread?
 
yes
that is one of the worst threading designs known to exist.
 
user1804599
And store a vector of AnyRenderable.
 
@рытфолд So std::function<void(RenderContext&)>?
 
user1804599
1:06 PM
Or just a vector of std::function<void(RenderContext&)> top kek.
 
could you elaborate on why its one of the worst?
 
user1804599
It's fun to implement this pattern every now and then to discover you can just use std::function instead.
 
because
the thread balancing is out of whack.
 
afaik there are only two: render thread = main thread, render thread = non-main thread
 
no.
the whole idea of making a thread the "main" thread or not is bullshit.
it's only necessary if you use a crappy API which has such a concept.
you should use as many threads as the hardware can support to perform each job.
and perform each job in serial so that you're not wasting time synchronizing each one.
 
1:09 PM
I'm using OpenGL; you typically dont work with that in parallel
 
well, actually, the newer OGL versions do have parallelism support, just like DX11 does, from memory.
but more generally, there's lots of work to be done that isn't just calling OGL.
 
In actual use I'll have multiple data threads, each will prepare data and then asynchronously submit it to the render thread
 
for example, calculating matrices.
 
Yeah I'm not doing anything on the render thread outside of the bare minimum. It just does the OpenGL calls. All heavy calculations will be done on data threads. The main thread does system event processing
 
user1804599
Make the game state immutable and the only synchronisation you have to do is when reading or writing a single atomic pointer!
 
1:12 PM
@Pris There's still no excuse for a main thread. The main thread can just act like a data thread as long as rendering is going on.
 
@Puppy the set up I have is similar to qt. The main thread can be used for work if I want... every thread has a lockless mpmc queue.
 
having a setup similar to qt is a bad thing
 
I have to preprocess large amounts of data (map data, this isnt for a game) every so often so whichever thread is doing that will have stretches where it cant do anything else. If I make the main thread do that I don't get to process events during that time
oh hey italics
 
This is a bold statement.
 
1:15 PM
@Pris Why bother processing events? You can't render any response to them anyway.
 
but say you wanted to do somethign simpler, like a UI, you can throw that into the main thread. no problem [in theory]
 
and assuming that your render thread is remotely effective, the CPU will be completely used whilst rendering, so you can't even process a response.
 
@Puppy maybe I want to log events? Maybe I want to respond to the OS so it doesn't terminate my process?
 
if your render loop is taking so long that the OS is going to terminate your process, then not processing events is probably a smaller problem.
also OSes don't terminate processes just for not responding to events.
 
@Puppy why would the CPU be completely used? most opengl calls are non blocking, any driver that isn't total shit will be just fine
@Puppy so you've never done mobile dev I take it?
 
1:17 PM
@Pris Er, your data threads?
what I'm saying is that there's a contradiction here.
you're doing a whole bunch of extremely low-level threading crap to render quickly by using all of the CPU's resources
and then you're concerned about doing some other task as well in parallel?
if you're writing an application to be used by users interactively then you should not take that long to render each frame.
 
what low level threading crap am i doing? i have a render thread, i submit work to it. its like the most common setup ive come across.
 
that is a whole bunch of low-level threading crap.
 
user1804599
@FredOverflow Only part of it is bold.
 
it may be forced upon you by other crap, but that's another matter.
higher-level parallelism is stuff like parallel_for_each or tasks.
if you're needing to worry about what thread is doing a thing, then it's pretty crappy.
I'm not saying that's gonna be your fault, but it's still terrible.
 
rendering individual frames isn't what causes a stall, its setting up the data which happens intermittantly. Think about a game; you have to load scene data every so often. What happens if you start loading assets from disk in a rendering thread?
 
1:21 PM
right, but in my proposal, you would not start loading assets until after a frame is done.
 
... it doesn't matter. Any significant asset loading will eclipse multiple frames.
 
ok then, so it'll be a background task
 
yes, a background task that my 'data thread' handles
once the data is ready you have to sync to the render thread
 
what version of ogl?
 
im targeting 2.1, ES2
basically using ES2 with a couple of common extensions like FBOs. 2.1 generally has support for that stuff too
 
1:27 PM
well I'd probably just run all the data threads in parallel, then do the non-blocking OGL calls and asset loading calls, then run the simulation in parallel.
 
oh boy, im passing a std::function<void()> as an argument for a signal which is a variadic template class which binds its arguments into a std::function<void()>
its callback inception
 
1:53 PM
Morning
 
i didnt know how badly i wanted one of those until you posted it
 
I really should get some compressed air to blow out my computer
 
2:08 PM
@thecoshman use a hoover; fear not, static discharges are your friends
 
@ScarletAmaranth I don't have a Hoover
 
user1804599
@Jefffrey eww
 
@thecoshman an arbitrary vacuum cleaner will do
 
I do use one to get some of it, but it canny get the deep shit that's packed in
also, when trying to boot of a live usb disk, make sure it actually has an OS on it.
speaking of which, time to reboot and sort out drives :P
 
microsoft is open sourcing all the things github.com/dotnet/orleans
 
user1804599
2:21 PM
new Orleans()
 
There could be trouble ahead. A West Ham fan has entered the club without presenting a valid rabies vaccination certificate.
 
2:43 PM
-1
Q: Alternative to system()

PDFI recently got into c++ programming, and I have gotten a lot of experience with it. My past few programs have been using the system() command, which I have read is supposed to be a really bad idea. First of all, why is it such a bad idea? I am using it on Linux for things like clear the screen [e...

 
lol system("./menu"), waddafuq
 
Is there a generic way to copy a container? Or do i have to build my own?
 
auto x = y;.
 
@Puppy that doesn't work for C arrays
 
C arrays are not containers.
 
2:45 PM
there is no container concept in the standard or the STL, so i guess we disagree
 
there is a set of Container requirements in the Standard.
stuff like container::value_type.
 
why'd that poor dude get so many downvotes? it didn't seem like it was that bad of a question
 
it's no accident that all Standard containers have begin() and end().
 
@Puppy neither that non-member begin and end had been added, to get the value_type of a C array you can just use iterator_traits<>
 
iterator_traits is not for containers, it is for iterators.
hence the name, iterator_traits.
 
2:48 PM
there is no container_traits < >
 
because pretty much all of the Container requirements are direct members and nobody gives a shit about C arrays.
std::begin and std::end is about as far as you'll get.
 
and T::iterator is not generic, same argument as for non-member begin/end
 
it's perfectly generic for actual containers.
 
@Puppy if no one gave a shit about C arrays, there would be no non-member begin/end..
most of <algorithm> test in libc++ are implemented with raw C arrays..
 
that's great for libc++.
 
2:51 PM
cause they do matter and they do suck
 
Holy shit, this is a whole lot to take it. Thank you very much :) I will need quite some time till I understand everything, but i will take it — Uzaku 5 hours ago
Just a little, then, maybe
 
unless you want to get Howard Hinnant in here and ask him why he did that
it's totally irrelevant.
appeal to authority, specifically.
he probably did it that way exactly because they're not actually containers so if he wrote a thing that accidentally depended on being given a container instead of a range, it would fail.
 
user1804599
> my uint64 $x = 1;
1
> $x
0
 
user1804599
:(
 
@gnzlbg There's a world of difference between non-member begin/end and actually caring about C arrays.
 
2:52 PM
@gnzlbg that's bullshit. Non-member begin/end are splendid for many many more non-intrusive adaptations. C arrays have nothing to do with that
 
@sehe the fact that you cannot intrusively adapt arrays?
 
@sehe how long did it take you to write that snwer
 
@gnzlbg The fact that this is only a random example
 
well they have std::overloads for C arrays..
 
user1804599
Oh REPL bug.
 
2:54 PM
if they wouldn't matter they wouldn't have.. AFAIK they just call .begin() unless for C-arrays.
 
@Pris You can do the maths from the timestamps. I admit I put the kids to bed, had coffee and may have other breaks. And I didn't do much in the afternoon :)
I only spend this time because I want to see the pitfalls /for myself/
 
@gnzlbg You are assuming that the Committee does things about things that matter. They don't.
they waste time shitting around with std::thread instead of providing actually useful threading stuff, they add broken features like uniform initialization, and they ignore serious problems like Unicode support, or ranges.
the Committee's actions and what really matters are completely orthogonal.
 
C-arrays are supported by <algorithm>, begin/end/size, and iterator_traits
they are not copy-constructible, and there seems to be no way to generically deal with them if you need to copy stuff, so i need to write my own
 
right, because nobody gives a shit about C arrays.
 
that is wrong, cause i do
 
2:57 PM
@gnzlbg std::array<> was made for this.
 
otherwise i wouldn't be asking
 
if your users bitch about it just tell them to use std::array like normal people.
 
@gnzlbg Good luck. Godspeed
 
template<class T> foo(T&& a) and users passes a C-array
instead of std::array, or vector, or whatever, std::array doesn't help me there a bit
 
Asking != whining.
You don't pick up an annoying, near impossible task and then complain that it's too freaking much work. You picked the wrong task
 
2:58 PM
sure it does.
 
Tilting at windmills is an English idiom which means attacking imaginary enemies. The word "tilt", in this context, comes from jousting. The phrase is sometimes used to describe confrontations where adversaries are incorrectly perceived, or courses of action that are based on misinterpreted or misapplied heroic, romantic, or idealistic justifications. It may also connote an importune, unfounded, and vain effort against confabulated adversaries for a vain goal. == Etymology == The phrase derives from an episode in the novel Don Quixote by Miguel de Cervantes, wherein protagonist Don Quixote fights...
 
simply static_assert that T is not a C array.
problem solved.
 

« first day (1562 days earlier)      last day (3388 days later) »