« first day (1090 days earlier)      last day (3875 days later) » 

6:00 PM
@Ell It's one big function called render which will loop trough a vector (first object) to gather the textures it needs and then draw them into a window (second object).
 
template<typename T>
typename std::remove_reference<T>::type&&
M (T&& x)
{
    return static_cast<typename std::remove_reference<T>::type&&>(x);
}
(untested)
 
@Ell, the other functions are functions called by render.
 
I'd probably call it mv rather than M
 
sbi
@Jefffrey A function implements an algorithm. A class implements the prototype of an object.
 
@Rapptz Why not though? E.g. I don't think it's unfair to assume successive calls to select until all future values are exhausted. That's a lot of future objects.
 
6:00 PM
@sbi I downvoted the other answers for good measure, if Pete drops the const I'll upvote his
 
still short but you understand what it means
 
std::mooooove
 
Ell
template<typename T>
decltype(auto) M(T&& x) { return std::move(x);}
 
@sbi Hmm. Ok?
 
Ell
?
 
6:01 PM
declspec?
lol
 
Xeo
Just shared_ptr the heck out of everything!
 
n(n+1) / 2 to be precise.
 
Ell
oops :P
 
@Pawnguy7 wut?
 
Xeo
(Being ignorant to life-time issues can be so nice.)
 
6:02 PM
@Rapptz I have seen that, was is that again? Some compiler-specific stuff?
 
For a second there, I thought there really was a declspec keyword I never encountered :v
 
Xeo
MSVC attributes, basically
 
I'm not sure why you bring up lifetimes. I don't think there's a problem in that respect.
 
Xeo
__declspec(noreturn) and such
 
sbi
@TemplateRex I have a ton of respect for Pete, but I downvoted his answer anyway. :)
"Do as the ints do" is a very basic rule of operator overloading and I happen to agree with that. This class' operator+=() violates that rule. — sbi 19 mins ago
 
6:02 PM
274
Q: How many levels of pointers can we have?

ParagHow many pointers (*) are allowed in a single variable? Let's consider the following example. int a = 10; int *p = &a; Similarly we can have int **q = &p; int ***r = &q; and so on. For example, int ****************zz;

So far I have only done three.
 
One is plenty
 
@Pawnguy7 You should feel bad.
 
Xeo
One (void*) is plenty.
 
@Jefffrey I was told that, yes.
 
sbi
6:03 PM
@Jefffrey If they are functions for good reasons, don't make them members of a class just for convenience. If you have too pass around too many parameters, wrap them in some object instead.
 
@sbi I would agree with that, but that should not factor into a voting decision
in fact, the higher someone's rep, the higher the standard should be
 
Why is it that you need to declare them in this fashion? A pointer should only know the size, correct? An int * and int *** are the same size.
@Jefffrey it was for the 3D array on the screensaver
 
@sbi When is a function a free-function for good reasons?
 
Screw you guys, I'm implementing it. Quadratic blow-up is serious business.
 
sbi
@TemplateRex My respect is not because of SO. (I didn't know he is active here.)
 
6:06 PM
fatal error C1026: parser stack overflow, program too complex
that's a cool error
 
@Rapptz Amazing.
 
You're quite a cool person ;_;
 
sbi
@Jefffrey When it implements a simple algorithm that operates on some data.
 
Xeo
@Pawnguy7 They may be the same size, but they point to different stuff.
Also
 
@sbi btw, about your FAQ: I would prefer L <= R to delegate to !(R < L), instead of !(L > R) as you have it now. It's nitpicking, but it saves the compiler one layer of inlining
 
Xeo
6:08 PM
4 mins ago, by Xeo
One (void*) is plenty.
 
sbi
@TemplateRex I prefer what is easier to understand. Inlined indirection comes for free.
 
@Xeo is it not a distinction without a difference? The use of a * and a ***, of the same type, is the same, is it not?
 
@sbi That's the same definition of a member-function in a class. The only difference is the access (global, public, private...) of that data.
 
Xeo
@Pawnguy7 Let int* a = ...; int*** b = ...;, what do you get when you do *a and when you do *b?
 
@Pawnguy7 int* points to an int in memory. int** points to a pointer to int. If you dereference the latter, you're going to get an int*, which you can deference to get an int. For the former, dereferencing will give an int.
 
6:10 PM
... and int ** ...?
 
Xeo
Only speaking in terms of types
 
@sbi I think Howard Hinnant wrote something about it that in libc++ he prefers avoiding calling such extra thin wrappers because sometimes in deeply nested expression, inlining might not come for free
 
Xeo
aka what is decltype(*a) and what is decltype(*b)?
 
sbi
@Jefffrey Of course there's no hard mathematic formula. What did you expect? It's all down to fashion, your believes, and preferences. In the early to mid 90s, everybody would have yelled at you to make classes.
@TemplateRex He wrote the standard library for a compiler. (So did Pete, BTW.) We're mostly writing application code, and maybe some libs to be used in a few applications. For us, inlining is free unless profiling proves it wrong in some certain exotic settings.
 
Xeo
Or, to come back to your 3D array, can you do a[0][0][0]?
 
6:12 PM
@sbi I feel like a class that only handle references is a useless class. But a function with too many dependencies is not good either (especially if some of those arguments are passed to all other related functions). I've also though of a functor, but that's not what a functor is made for. What do you think? How would you solve this?
 
@Xeo yes?
 
Xeo
No.
a is int*, and a[0] yields an int. Ints don't have subscriptions available.
 
@sbi hmm, that sounds like the i++ pessimization. The reasoning should be the other way around: avoid possible missed inlinings by reversing the arguments. Shouldn't be too hard for users to parse.
 
sbi
@Jefffrey As I said: Do you think of it as a set of algorithms that you have to pass a few parameters to? Make them functions. Do you think of them as a set of method manipulating the state of an object? Turn the while mess into a class.
 
I would argue that the core of classes is invariants.
 
6:15 PM
@Xeo what if you could only do * and **?
 
sbi
@TemplateRex I am a strong advocate of using ++i by default, because it better tells about the intent of your code and might be faster in a few corner cases.
 
if you consider vector::push_back as a free function push_back(begin, end, capacity, const T&), the invariants of begin/end/capacity's relationship are not enforced.
 
sbi
@DeadMG That's probably as a good a rule of thumb as they come for this. I'll try to remember that.
 
@Xeo What if there is an implicit conversion from int to MyClass, and MyClass defined operator[]? ;)
@sbi Also, the semantics of ++i are a lot simpler than those of i++.
 
sbi
@FredOverflow Yep, that, too.
 
6:17 PM
I have yet to have a non-language-lawyer explain to me what i++ actually does.
 
adds 1 to i, returns old value.
 
sbi
@FredOverflow Then you would be eligible for a whack on your head for writing that class.
 
-2
Q: Creating an effective C++ library website and documentation

Andrew HundtCreating a C++ library also means documenting it so that others can use it, and that documentation can vary dramatically in quality. How should a website for a C++ library be structured so that it is most effective, and are there any pearls that can be held up as quality examples? To frame the...

 
@DeadMG You are designing your own programming language. You don't count as a non-language-lawyer :)
 
I implemented it in Wide as copy := i; ++i; return copy;.
 
6:18 PM
@Feeds lol
 
@FredOverflow True, but the explanation is not language-lawyer.
 
Xeo
@FredOverflow That would do nothing.
 
@Xeo It would work in Scala ;)
 
sbi
@Rapptz That was quick! I was just about removing the tag.
 
Xeo
this isn't subject to conversions
 
6:19 PM
++i;
 
could do
 
Apparently I forgot how to format again.
 
but I prefer the other version because then i doesn't have to offer operator-(int).
 
Ctrl + K
 
@DeadMG That is different though. You can clearly see that push_back should be a member function. In my example, I'm not sure if an object that only holds references should be an object at all.
 
6:19 PM
It's still not clear when the increment actually happens (hint: not until the next sequence point).
 
Xeo
return i; ++i; // magical time-traveling function
9
 
lol
 
user1804599
Multiple cursors in ST2 are so nice.
 
@Jefffrey The question isn't whether it's clear that push_back should be a member. The question is why it's clear that push_back should be a member.
 
Xeo
@FredOverflow Sequence points are dead
 
6:20 PM
as for your question, the simple fact is that the data members you need for implementation are more or less irrelevant.
 
try {
    return i;
} finally {
    ++i;
}
 
it's the interface that counts.
 
sbi
@Xeo There must be a prequence point in that function.
 
@Xeo I know, but it's not like sequenced-before is any more popular among laymen :)
 
Apparently when editing time runs out, it takes what you have :\
 
6:21 PM
What else would you prefer?
 
Me?
 
sbi
@FredOverflow #pragma do_what_i_want
 
user1804599
@FredOverflow I wonder what happens if I do @try { return true; } @finally { return false; } in Objective-C. :P
 
I would think it makes more sense as the unedited version (or last successful edit) given context of what is around it.
 
6:23 PM
@not-rightfold In Java, it returns false.
 
user1804599
lol
 
@DeadMG Right. But I'm not even sure how I would call a class, whose only purpose is to render a game frame (with its method render). Isn't it a sign that maybe the thing I'm trying to describe is not supposed to be an object?
 
it's definitely supposed to be an object.
 
I wonder what try { throw new Exception(); } finally { return 42; } does...
 
6:24 PM
@Xeo I think I thought it worked like that once :(
 
there's lots of state that you don't want to expose to your user in rendering.
for example, a D3D Device/OGL context.
 
Xeo
@FredOverflow return 42;
 
user1804599
 
@Xeo The exception just vanishes?
 
@DeadMG all hidden within the sf::RenderWindow class.
 
6:25 PM
then I would agree- what purpose does another class serve.
 
user1804599
I wonder if Objective-C exceptions work with C++ exceptions.
 
Xeo
That's Objective-C++
 
@Xeo -> std-proposals as std::past(i)
 
user1804599
@Xeo Well, not necessarily.
 
@DeadMG I don't know. But a method render_game(window, world, objects, textures) just doesn't seem right to me.
 
Xeo
6:26 PM
@DeadMG IIRC, there's one rule for finally: It is always right. Exception: When you pull the plug.
 
user1804599
You could call a throwing extern "C" C++ function from Objective-C code.
 
user1804599
I want to know whether the @finally clause still gets executed.
 
user1804599
Oheh, undefined reference to objc_exception_throw'` when I use C++ throw in Objective-C++.
 
depends on whether or not the ObjC and C++ ABIs are compatible in that respect.
and I kind of doubt it.
 
@DeadMG yes
 
6:27 PM
@Jefffrey what is objects?
 
user1804599
Hmm.
 
@Pawnguy7 a vector of objects.
 
user1804599
@DeadMG Apparently, they only do in 64-bit environments.
 
@Jefffrey a specific sort of object?
 
user1804599
And catch(...) and @catch(...) behave identically; they catch all Objective-C and C++ exceptions.
 
6:29 PM
@Jefffrey If you don't have any state you need to store between calls and maintain invariants on, then it's right.
 
@Pawnguy7 game objects (trees, players, bullets). It's just an example.
I should read more about invariants.
 
Is textures a vector?
 
yes
 
Alright people.
I'm opening a fourth VS2012 instance. Wish me luck.
 
@EtiennedeMartel Why do you need 4 instances?
 
6:31 PM
@Jefffrey are you aiming for some data-oriented approach here?
 
yes
 
Xeo
Y'know, we should stop this unproductive on-topic off-topic talk.
 
@GamesBrainiac Because I need to keep 4 solutions open.
 
@EtiennedeMartel And let me guess, you have 4 monitors?
 
@GamesBrainiac I have 2.
 
user1804599
6:33 PM
Huh.
 
@Etienne is any of those instances debugging another?
6
 
@EtiennedeMartel lol
 
user1804599
> error: no type named 'vector' in namespace 'std'; did you mean 'hecto'?
 
I wish I had more than one monitor.
 
Xeo
@R.MartinhoFernandes lol
 
user1804599
6:33 PM
Oh, forgot to pass a template parameter to vector. You’re being helpful, clang.
 
@not-rightfold this just occurred?
 
His boner, after you entered.
 
@not-rightfold This again?
 
Engine, tools, other set of tools, asset pipeline stuff.
 
6:35 PM
♥ v ♥
 
user1804599
Time to try SublimeClang.
 
time to try sublimating your face.
4
 
> Plugin discontinued
Amazing.
 
user1804599
I know.
 
omg a rabid dog
 
user1804599
6:39 PM
But I can still use it.
 
user1804599
I could try completion but meh.
 
user1804599
Actually, I will.
 
Nobody here has ever used Git.
 
omg no
fuck you, puppy
 
@Jefffrey not sure. I have never really used textures. Although, I find the most troubling part of this to be, how do you know which texture goes with what?
 
6:40 PM
@DeadMG that was mean man.
 
personally, I prefer VSS.
 
I was going to say octocat.
 
or maybe TFS.
 
6:40 PM
@Pawnguy7 enums
 
I have no idea what's going on ;.;
 
although OTOH
source control is for pussies.
real men only commit once a month.
Or two.
 
@DeadMG You're a bitch then.
 
@Jefffrey That seems to be a good idea, yes.
 
@DeadMG well played.
 
6:41 PM
@DeadMG go get some sleep, really. it wasn't that bad of a question
 
I'll be well played when I have to stop sitting over this fucking bucket.
 
Real men use Fortran.
 
@Abyx It's a question.
 
also, I can't sleep until at least 9pm.
 
6:42 PM
@DeadMG so what?
 
and even when it gets to then, I will probably be too sick to sleep.
 
Why the heck are you over a bucket?
 
I had the utter temerity to consume a sandwich today.
 
@Abyx whats the color of your sky over there?
Mine's gone a little dark.
 
@R.MartinhoFernandes Buckets are a common requirement for people with gastrointestinal distress, you know.
 
6:43 PM
@GamesBrainiac it's dark.
 
@Abyx Thank you for answering my question. :)
 
@DeadMG "Trying the same thing over..." comes to mind.
 
@GamesBrainiac np.
hg > git anyways. for each definition of ">".
 
@Pawnguy7 There's five weeks between now and the time when the hospital will think about considering scheduling surgery. I need some nutrients in that time.
 
five sandwiches.
 
6:45 PM
at this rate, it'll be less than five.
 
An unfortunate predicament, yes.
 
@Abyx git works just fine for me. If I'm happy with something, I don't really change it.
@ScottW beautiful.
 
@DeadMG, does this look like a good interface to you?
@ScottW photoshop gradient too much?
 
seriously, Entity IDs?
what the fuck is wrong with you.
 
lol, why?
 
6:48 PM
l Öl
 
user1804599
@ScottW Full of beauty.
 
and type enumerations?
go back to school.
 
:(
 
user1804599
@Jefffrey Dat code.
 
user1804599
@R.MartinhoFernandes That looks like a guy with his mouth open and his arms up in the air in great fear.
 
6:50 PM
@DeadMG I'm following the component based architecture. You have to have IDs and component arrays (a map was more space efficient though).
 
@Jefffrey it looks bad. like a weird data structure
 
@Jefffrey Then pick an architecture which doesn't suck horrifically.
 
I asked about components and entities yesterday. Not a fan, apparently.
 
You can get unique IDs from this
 
speaking of components I want modules :'(
 
6:52 PM
@DeadMG such as?
 
@Jefffrey It's awful.
 
@ScottW it's pissing down here in uk
 
@CatPlusPlus Got it.
 
@Jefffrey Build one that meets your actual needs.
 
Do you have non-existing entities? I am confused.
 
6:52 PM
Why do you hide objects behind silly IDs, and make a class that reinvents subtyping badly
 
@R.MartinhoFernandes The only thing I'm going to fairly say about that is that you cannot use that over a network.
so I might say that for a multiplayer game, you might reasonably want some kind of separate ID system to identify objects cross-computer.
 
Have a zombie/human types and make entity a sum of those
 
@R.MartinhoFernandes don't. UID means that I can store it and then check whether it's valid (i.e. object is alive). With this it can become an id of another object.
 
You shouldn't have non-alive objects.
 
If you can access a dead object you lost already
 
6:54 PM
agree.
 
Leaving your address space is a fair concern, I agree.
 
If that's a concern, then you need shared ownership probably.
 
well, you can use shared_ptrs to keep objects alive.
and it will be ~slow~
 
user1804599
Cabbage collection!
 
eh
I had more of a deferred-destruction destruction-callback system going on.
 
6:57 PM
@ScottW That's not your sky, that's everyone's sky.
 
You mean a GC
 
not really.
the destruction was deferred but not arbitrarily- only until the end of the current simulation tick.
 
Oh, right, I forgot that ALL GCS ARE EVIL
 
Arena GC is OK. sort of.
 
I consider them as pretty evil really.
depends on the use, of course.
 
6:58 PM
like nukes
 
ITT GCs are like nukes.
 
user1804599
GC is great.
 
I'd be pretty sad without nuclear power.
and there's no telling what state the world would be in without MAD preventing WW3.
 
I wouldn't; most of my electricity is produced by hydroelectric dams.
 
Does this look better?
 
6:59 PM
There's a chance there wouldn't be any taxes
 
user1804599
Also Vicarious is a great song.
 
MAD is overrated.
 

« first day (1090 days earlier)      last day (3875 days later) »