« first day (1623 days earlier)      last day (3318 days later) » 

10:01 PM
@Blob nooooooooooooooooooooo , at least drink more spirits
 
@sehe lol no
 
@CatPlusPlus What do you call that?
 
Stake
 
0
Q: Does assignment or conditional bind stronger?

FredOverflowI just stumbled upon the following pair of C++ grammar rules: conditional-expression: logical-or-expression logical-or-expression ? expression : assignment-expression ^^^^^^^^^^^^^^^^^^^^^ assignment-expression: conditional-expression ^^^^...

Rep whores: on your mark, get set, go!
 
I want to buy downloadmorevram.com.
 
10:09 PM
Have you tried buydownloadmorevram.com?
 
@FredOverflow now gimme my rep
 
FredOverflow is the smartest idiot on planet SO.
 
someone, write a better answer before the can't-accept-answer period is over
 
@FredOverflow that's what you get for ever looking at MSDN for anything that is not win32 api
 
Actually, I was looking at the operator precedence table in "C: A Reference Manual", but C is not C++.
 
10:16 PM
personally, ternary operator is dumb
 
If I recall, ?: has special "magic" precedence in the spec where it doesn't really sit cleanly in one place. I'll see what I can find — Mooing Duck 38 secs ago
 
I think edit > continue > commit is much more common than red > green > refactor
 
Magic? This could be interesting...
 
@VittorioRomeo You have come to the right place! Lounge<C++> is were UDP experts discuss network programming issues.
6
 
@orlp: I apologize. Not the best choice, the gamedev.net forum is way more suitable. ...I was intending to use C++, though :P
 
@VittorioRomeo don't feel bad, he stole that line from Fred.
 
@Blob No
This is SO, where everything is creative commons!
 
Oh god, I created a meme!
 
even chatroom messages? :|
 
10:21 PM
@FredOverflow nice.meme
 
hi
 
@Rapptz Hey Zapptr
 
@WredOverflof I think this operator precedence was changed from C to C++
 
Are people still falling for Singletons?
 
10:23 PM
>gamedev.net
l o l
 
@FredOverflow I've succesfully used a singleton
but that was in thread-local slab allocator that had to be a singleton
 
@FredOverflow It seems to me that game devs are nearly always 10-15 years behind the times.
 
@FredOverflow honestly, it looks like a good patter at first
 
user1804599
> I used to think that i was using singletons, but really i was using static variables instead
 
10:24 PM
@Rapptz I done goofd
 
@Puppy Na, that would imply game devs already use C++98.
 
true
 
I'm a singleton.
 
game devs use C-with-classes
 
Hm so why we're singletons bad again? Code coupling right?
 
10:24 PM
@Rapptz I'm a singleton.
 
We're all singletons.
 
@Rapptz that explains why this world is shit
 
inb4 singletons for simpletons
 
-5
Q: What's wrong with singleton?

Jakub ŠturcDo not waste your time with this question. Follow up to: http://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons Please feel free to bitch on Singleton. Inappropriate usage of Singleton may cause lot of paint. What kind of problem do you experienced with singleton? What is c...

 
mutable singletons
 
10:25 PM
> Inappropriate usage of Singleton may cause lot of paint.
lol
Maybe Singleton users get high off the paint?
 
it'll colour your walls bright neon purple
 
Say I have a Sprite Pool. Is that so bad?
 
It's called sprite batching and it's not exactly a radical idea.
 
@Cinch likely not.
 
sprite batching is a different thing
at least I would think so intuitively.
 
10:29 PM
But a Sprite Pool is a singleton?
 
Does every part of your system need access to the Sprite Pool?
 
what exactly do you mean by Sprite Pool?
and also, don't ever use Singletons.
3
 
Oh you mean a resource pool
That's pretty bad.
 
But why?
 
because they're global mutable state.
 
10:30 PM
Say I have 100 objects using the same sprite
 
which means that you can never control their state in any meaningful way, and furthermore, refactoring them is fucking impossible because you have 9999999999 use sites
 
@Rapptz I used it succesfully for a slab allocator...
 
am i correct in assuming "sprite" refers to some 2d image in this context?
 
Yes
 
@Cinch Then just create them with a pool argument in the constructor.
 
10:31 PM
why can't they be const?
 
Also, you cannot mock Singletons. But you can make fun of them!
 
@Puppy I already do
 
@Cinch Then why should the Pool be a Singleton?
 
Oh right. I compiled SFML yesterday.
 
Sure you can mock singletons.
 
10:31 PM
I wonder if it still segfaults.
 
pass the pool as an argument -> problem solved.
 
@Puppy He is probably afraid he might create additional pools by mistake :-)
 
oh noez.
 
How do I make sure my program uses exactly 17 if statements? Is there a Design Pattern for that?
 
@Puppy Oh yeah I already do that.
 
10:32 PM
more generally, I'd argue that the pool is more of a cache, so it shouldn't affect observable semantics and therefore doesn't really count as a Singleton as it's not really mutable in the conventional sense.
 
@Puppy Yes, true.
 
You add things to a cache.
 
assuming that you implemented the Pool in a vaguely sane fashion of course.
 
How is that not mutable?
 
But the Pool is basically a structure to do reference counting.
 
10:33 PM
@Rapptz Because the user can't observe the difference.
@Cinch shared_ptr, done.
 
It's still mutable.
 
@Puppy Yup.
 
nah
 
Just because the user doesn't notice it's mutability doesn't make it non-mutable.
 
Well, it's immutable in the sense that the resource will never be changed.
 
10:34 PM
> Should I choose another pattern rather than building a sticky mess of singleton spaghetti?
> Yes. The answer is yes.
 
It's just loaded and unloaded as needed.
 
there's a difference between mutation as an implementation detail and mutation as interface semantics.
mutation as implementation detail is a completely different thing to mutation as interface semantics.
 
I don't know, I feel that a Sprite Pool is the correct way to handle texture loading.
 
> but... now, with singletons my life is easier, and only I have like four of them.
 
The problems are still there as an implementation detail unless the implementation goes out of its way to fix the problems with concurrency.
 
10:35 PM
well, it's fine, because if you design the pool correctly, it will be as-if-immutable.
 
@Puppy Indeed.
 
@Rapptz Which of course it will, since the guy implementing the pool knows he has to handle it.
 
I doubt it.
 
but Singletons have far more problems as interfaces than as implementations.
 
That's the other problem--how might I handle concurrency with a Sprite Pool?
 
10:36 PM
See?
 
it's pretty dodgy, more-or-less.
 
user1804599
@FredOverflow if [ 17 -ne $(cat **/*.{cpp,hpp}(N) | perl -ne 'print if /\bif\b/' | wc -l) ]; then echo "oops"; exit 1; fi
 
you can use a concurrent data structure if you're brave and competent (you're not)
 
user1804599
Add that to your build system.
 
10:36 PM
or just use a slim reader/writer lock.
 
user1804599
It assumes there's at most one if statement per line.
 
user1804599
Only an idiot would put more in one line anyway.
 
or just use a regular lock until you find you have a problem.
 
@райтфолд What if the programmer cheats by defining an IF macro?
 
Hm.
 
10:36 PM
locks are only slow if heavily contended really.
 
Yeah I'm not too good at multithreading.
 
user1804599
@FredOverflow Same thing.
 
just throw a lock around the structure for now and then come back to it later if it's slow.
 
Yeah... what is a lock?
I don't know any multithreading.
 
ah well
 
10:37 PM
I've been focusing on just doing regular programming first.
 
then I'd say fuck the Pool for now and just load the sprite a billion times.
 
You basically "lock" a portion of code allowing access to it only to a single thread at a time.
 
@Puppy But I mean that's ridiculous!
 
@Cinch It's perfectly fine.
 
That means I allocate everytime I load the same texture?
 
10:38 PM
sure.
 
You should load each sprite multiple times per frame! Everything else would be premature optimization.
 
here's the thing.
 
@Cinch In my small game framework my Texture is stored in an std::unique_ptr and I just pass a reference to it to my Sprite instances
 
adding the pool in later is trivial.
but if you make a bad Pool now and then add threading, you'll have to go through and find every fuckin' thing you did wrong and fix them all up.
 
Not sure why you would need to load the same texture multiple times?
 
10:39 PM
and you'll have ten trillion Heisenbugs because you didn't find all the spots.
 
@VittorioRomeo Windows.
Units.
 
so
 
@Cinch elaborate?
 
it's much less work to just only add the cache when you know how to write the cache.
rather than adding a cache and then having to fix it up later
it's not like your app will spontaneously combust if you don't deduplicate them
 
@VittorioRomeo Well, I had a GUI system.
And I had sprites loaded for the Windows and such.
 
10:41 PM
Implementing a sbo-enabled vector. Using variant<static_vector, vector>. It feels kinda sloppy. Like it's too easy.
 
what it's really about is giving your future self an easy time of things, and adding a cache when you don't know how to make it safe is a quick way to give your future self a massive headache.
 
It would be highly inefficient to load resources multiple times.
 
@StackedCrooked The best I ever did with that was an EBO-assuming allocator.
@Cinch Who gives a shit?
inefficient is relative.
 
I'm planning to program for mobile.
 
@Cinch: you don't "load" sprites. You load Textures, which are big and expensive. And you load them once. Sprites are lightweight objects that have a const reference/pointer to a Texture and some data on their position/rotation/etc.
 
10:42 PM
your app probably doesn't do anything even vaguely remotely thinking about resource limits right now.
 
@VittorioRomeo Yeah, sorry, textures.
 
you can go and change it later when you actually know what needs changing and how to change it.
doing anything else is just making unnecessary work for yourself
 
Welp 4096 DDS has 400MB
 
@Cinch: Well... load the GUI texture once and pass it to the Sprite instances as a pointer? I don't understand the issue here
 
@VittorioRomeo Yeah exactly, except people say it might be the wrong way to do things.
They say that Singletons are quite bad but the TexturePool is indeed a singleton.
 
10:43 PM
@VittorioRomeo But ManagerSingleton sounds so much more professional than pass-a-pointer!
 
I mean, isn't that case justified? Or is there some ultimately better pattern?
 
@Puppy Hm, so you used an stateless allocator? Care to expand a bit?
 
Singleton is bad, not the single texture
 
Are you reading correctly?
Cinch dude you really need to work on that reading comprehension skill of yours.
 
@Rapptz Probably not
 
10:44 PM
`class Application
{
Texture gui_texture;
};

int main()
{
Application app{};
}
`
 
SBO-vector seems useful as a hash bucket.
 
@StackedCrooked Hang on.
 
ta-dah, no singleton.
 
user1804599
fail
 
@VittorioRomeo lol Application class epic fail
 
10:44 PM
@VittorioRomeo meh
How is this different from int main() { Texture texture; }
 
FTR some frameworks require an application class
 
and those frameworks are bad
 
those frameworks are shit.
 
just saying
 
don't force something like that on users
 
10:45 PM
Okay 4096 can't be imported, because it runs out of memory :toot:
 
I mean, what do I do if each window needs the same textures?
Say I have about 15 textures that need to be used for each window.
I have 5 windows.
Or frame or such--it doesn't matter.
 
FWIW I'm not against things like game classes too much.
 
just load them 5 times.
 
@Puppy: what's the alternative?
 
you can easily fix it later.
 
10:46 PM
@Cinch Dependency Injection
 
@VittorioRomeo Putting it in main without the class?
 
I'd only use anything like an application class when the application is built as a library and hosted by something else
 
Why does building as a library change things?
 
@Rapptz: yeah, it's pretty much the same thing. You could just put it in main - not against that.
 
I mean, what would go in main() can now go in my_fnx() that is part of the library and is called by main()
 
10:47 PM
@Rapptz: I was wondering if there was an alternative to having a single place to load the texture once
 
@FredOverflow Explain? I basically see my own code.
 
(not that I would do things this way, just following the logical reasoning)
 
@Rapptz: you need an entrypoint for your application, and that's the place I would cache assets in
 
@Cinch I'm not exactly sure what Dependency Injection is, but it can't be worse than Singletons.
 
Because your lifetime is no longer the same as the lifetime of the host
DI is just common sense
 
user1804599
10:48 PM
@VittorioRomeo main is the entry point hth
 
Take dependencies as arguments
That's it
 
@VittorioRomeo That's the main function.
 
@CatPlusPlus Isn't real DI like frameworks and XML config files and stuff? ;)
 
@CatPlusPlus Oh.
Well I already do that.
 
user1804599
@FredOverflow DI frameworks ≠ DI
 
10:49 PM
I mean, the term that can be used for windows would be something like texture packs or styles.
 
@FredOverflow got any recursive descent stuff you can show me?
 
IoC containers just wire up the dependencies for you, but DI is just that principle
> Ran out of memory allocating 1610612736 bytes with alignment 0
:toot:
 
user1804599
lol
 
I understand that. I was wondering if and why actually loading the resource once in the entrypoint is considered bad practice
 
I managed to crash UE twice today already
 
user1804599
10:49 PM
alignment 0
 
But at least I have that fucking skybox now, if lowres
 
@VittorioRomeo No one said this.
 
@Rapptz I guess we misunderstood you
 
Your reading skills are poor as hell.
 
But I suppose a problem would be trying to dynamically load resources on the go
 
10:52 PM
We were talking about singletons.
 
@Rapptz "lol Application class epic fail" made me believe there was a flaw in that kind of design.
I admit my reading skill may not be the best though, English is not my native language.
 
The reading skill comment was towards Cinch.
 
@Rapptz I'm not so sure what a Singleton object really truly is if it's not a Texture Pool.
 
lol
 
There's no point having 'application' class unless you really know you need something like that
 
user1804599
10:53 PM
() is the best singleton.
 
Jesus.
 
I mean, the most I had was basically a class for each feature like a button or a list.
Interfaces + Polymorphism and the such.
 
@CatPlusPlus
@CatPlusPlus Well the point is having a place to store resources that have to be loaded once and live until the end of the application
 
No, it has nothing to do with creating things only once at start
That place is the entry point of the application
 
@VittorioRomeo Why would you use an Application class if you can do the same thing with free functions and putting the stuff in main?
 
user1804599
10:54 PM
@VittorioRomeo main does that.
 
The class is pointless.
 
@Rapptz Oh, btw, can you do sandboxing with Sol? I didn't see an example with that.
 
user1804599
int main() {
    T x; // x lives until the end of main
    f(x);
    // x still lives!
    return 0;
}
 
@Cinch No.
 
And if you do have an application class, storing absolutely everything with application lifetime there is another design failure (SRP)
 
10:55 PM
@Rapptz Aw..
 
I mean what if I create a Lua script that hangs and I want a timeout feature?
Or maybe I could do that with threads?...
That's interesting... There must be some sort of system for C++ interrupts...
 
assume for a moment that the stdlib does apply EBO.
 
@Rapptz: True, the application class is pointless in that example. I still like using one in my projects so that I can organize my code in a better way thanks to its constructor/destructor and have the main do other things before/after instantiating the "application" class. "Application" is a bad name though, but the point of the example was showing the "unique" lifetime of the Texture resource, not the existance of an Application class
 
the real trick here is that you don't have to implement infinity forwarding functions or visitors or shit like that.
 
user1804599
10:58 PM
Applying EBO in the stdlib sounds like an implementation nightmare.
 
@VittorioRomeo wait wait wait
 
user1804599
You have to take into account shit like final.
 
you load all your resources in a single application class?
 
If you want to separate entry point logic from game logic, call into another function
 
@CatPlusPlus: But that's what I want to do. I have a GUI system that lives throughout the whole application and requires a single Texture.
What's the alternative here?
@Cinch: yes.
 
10:59 PM
@VittorioRomeo Change the name, decouple the types of resources.
 
@Cinch Check out debug hooks.
 
@Cinch: it's obviously more organized than that, but the concept is the same. Load at application start, unload at application end.
 
@Cinch Alternatively: Load all your textures in the beginning of main in a "TexturePool" and then pass it around whenever you want to use it. No singletons required.
 
@Puppy That's really cool.
 
Tearing most resources down is so pointless
 
11:00 PM
@Rapptz: That's what I was trying to say :P
 
Inheritance ftw.
 
@Rapptz Yeah I already do this so I don't see the problem?...
 
Jesus.
 
@VittorioRomeo I don't think you should pass the entire Application class though.
 
Anyway
 
user1804599
11:01 PM
@StackedCrooked The last time I used inheritance was ages ago.
 
user1804599
Inheritance is terrible.
 
@StackedCrooked It was an idea I had when the LLVM folks were bitching that their SBO vector basically had to reimplement all of std::vector, which is hard.
 
why, because perl doesn't support it?
 
@Cinch: I don't. Please disregard my earlier example. My intent was not showing the usage of an Application class but showing the unique lifetime of the Texture. There is much more abstraction and organization involved in my projects, as there obviously should be
 
but in this case, I prove that it's avoidable if EBO.
and furthermore, you could actually generalize Vector if you wanted to, since there's nothing std::vector specific about it.
 
user1804599
11:02 PM
@Blob Perl supports inheritance.
 
user1804599
It even supports multiple inheritance!
 
Is there some sort of way to cause threads to interrupt another?
 
@райтфолд who knew
perl's object-oriented? :|
 
i.e. freeze a thread and restart it if it hits a roadblock?
 
forget threads for now
90% of threading is simply having good design in the first place.
and another 9% is using support libraries in a good way.
 
11:04 PM
you should also learn about multithreading in general before trying to program with threads
 
user1804599
And the other 1% is using channels instead of mutable variables and locks.
 
there's no point in writing concurrent crap.
better to write single-threaded not-crap.
 
Is there a name for header files that just include other header files?
 
user1804599
High-level concurrency facilities master race.
 
@andrew convenient
 
11:05 PM
@andrew no
 
@andrew from now on, "hewrapader"
 
@Puppy Where do they store the allocator then? Are they storing it as compressed_pair with another member?
 
user1804599
What is a compressed pair?
 
user1804599
Is it like std::pair but with __attribute__((packed))?
 
it's a pair that inherits its members.
 
user1804599
11:07 PM
Oh!
 
So empty types don't take up space.
 
is there also a gzipped pair? :)
 
@Blob You don't need core language support for OO
 
user1804599
@melak47 any decent kernel compresses rarely used memory!
 
11:08 PM
@melak47 Useless trivia: I found that zip compression reaches break-even around 70 bytes.
 
@CatPlusPlus i assume you'd at least want it for multiple inheritance
 
Not really
 
@StackedCrooked hehe.
 
Having syntax might be more convenient, but it's definitely not required for implementing the machinery
 
user1804599
Any language which has tuples of functions is object-oriented.
 
11:09 PM
Tuples of functions?
 
user1804599
Aka objects.
 
@StackedCrooked read as "list of functions"
 
@Rapptz Here they used the name, but I couldn't find other uses. Do you think that "convenient header file" is a good name that is not misleading?
 
@andrew it's not "leading" at all. i suggest "hewrapadar".
 
11:10 PM
haha
Character: “ U+201C (LEFT DOUBLE QUOTATION MARK) is not valid C++. Do you code in MsWord? Please show the actual code you compile. Also, make it a SSCCE — sehe 6 mins ago
 
Why does it need a name?
 
@StackedCrooked No idea. I think they have a vaguely similar setup, but all the logic is in totally_not_std_vector and they basically reimplemented std::vector to support it.
 
I noticed this today: C++ allows you to control the data layout so you can optimize data cache access. However, it doesn't provide anything for controlling the layout of the instructions. Yet, instruction cache is not less important than data cache.
 
no, but it's a hell of a lot easier for the compiler to get it right without your help
since instruction layout is not observable.
data layout is
 
@Rapptz I am searching for a proper commit message. I just added a header file that just includes other header files.
 
11:13 PM
commit message: "Revert this commit immediately."
2
 
lol
How about "Added this, here's why"
 
@andrew "Initial commit"
 
Nobody cares about the cute label you give to it
 
@Puppy Boost does this all the time.
 
I like "Got a bitch in my /trunk"
 
11:14 PM
@andrew irrelevant
 
@andrew boost is also more or less designed to let you include fine grained pieces and still work. does your stuff still work if you don't use your "convenience" header? :p
 
convenience headers are what I've seen them called and what I call them myself
 
hm
 
@melak47 sure
@Rapptz ok. i'll use the name. thank you!
 
it only applies if what melak said is true though
 
11:22 PM
laff 4 commits and the repo is already 600MB
 
what did you commit
 
his .git directory
 
@melak47 grave misdeeds
@Cinch huh. once you froze it will not hit a roadblock. Anyhoops, it won't even hit roadblocks if thawed :)
@Rapptz hist 3d models and textures
 
UE4 starter content mostly
There's a lot of textures there apparently
 
gogo git push to github!
 
11:28 PM
I'm sure that'll work
 
@Rapptz git add .git && git commit -m "needs more git" did nothing for me :(
 
user1804599
11:41 PM
hi
 
user1804599
@melak47 You cannot add a repository to itself.
 
user1804599
In fact, Git is terrible at repositories inside repositories.
 
@райтфолд yeah, but why. it's just files....STOP OPPRESSING ME, GIT
 
Fucking user support fucking pisses me off.
Damn.
I mean, Garmin Viago's does.
> To help resolve this issue, clear the app cache and data. This can be done within the settings of your Android phone. Specifically under Application Settings. Once this is done, power cycle the phone.
Fucking generic answer to everything. "Turn it off and on again." IT Crowd nailed it.
 
Well well. That's bad. Really really offensively bad.
You realize that these answers dominate for valid reasons, right. Unless you wish to give Garmin remote access to your device (and a lot more of your money)
 
11:49 PM
@sehe I realize that it works for certain class of problems.
The problem I am having is not solved this way. I have reinstalled the application several times already. Still the same problem.
 
I'm not even saying it works. Just that it's a reasonable default start. And of course, you might not be helped (still it makes no sense for them to skip the advice)
 
The issue is that it ignores the inference that there is no GPS signal inside a tunnel.
 
user1804599
Alright, what to implement.
 
@wilx Why do you report that with Garmin?
 
user1804599
How about if-expressions?
 
11:51 PM
With extra salt, please
 
@sehe It is actually a second reply from them. Even after giving them a PDF documenting how the navigation matches my car to be in a tunnel despite the fact that I am on a street above or above and beside it.
 
@wilx So. You live right next to it (the tunnel)? How is it an issue? Or do you mean to say it's always shown as tunneled?
 
@sehe What do you mean? It is a vehicle position problem with their navigation.
@sehe What?
 
@wilx CLUE STICK: You never described a problem! I'm having to adjust my understanding of your rant every message. Latest I have is "My nav shows me as inside a tunnel /some time/ when I'm not actually in it"
 
@sehe It pretty much wrongly matches my car into the tunnel despite me being in a close street above it. The navigation should be able to infer that when it has a GPS signal it should not put the car at the link which has the tunnel attribute.
 
11:56 PM
> in a close street above it
Well this happens all the time IME
I agree that they might improve the software by using the signal strength to make inferences. Seems plausible.
That's not a problem report though. It's a RFC/enhancement suggestion if you ask me
Also, the map material could be simply at fault for this particular section
 

« first day (1623 days earlier)      last day (3318 days later) »