« first day (1787 days earlier)      last day (3160 days later) » 

4:00 PM
it's okay jk
 
@Mr.kbok aheh. ok then.
 
I know it looks underwhelming, that's the point
 
@Mr.kbok then again, I would sometimes write int _stdcall WinMain(void*,void*,void*,void*) :/
 
@edition You don't need to, if you don't use the parameters
 
@Mr.kbok oh. I see.
 
user1804599
4:03 PM
Is dereferencing v.end() UB when v is a vector?
 
yes
don't do it
 
user1804599
oh :(
 
user1804599
so to get a pointer to one past the end you need v.data() + v.size()?
 
Yes.
Or.
 
user1804599
well that's shitty
 
4:04 PM
((*((v.end())-1))+1)
 
@Mr.kbok I'd marry you for programming like that
 
user1804599
@Mr.kbok fails for empty vectors
 
write a function for this
 
auto f = &*v.begin();
auto l = f + std::distance(v.begin(), v.end());
 
user1804599
Is it also UB for std::string?
 
4:05 PM
No.
 
what
 
end looks like he's confortably tucked into multiple layers of blanket :P
 
In C++11.
 
oh right
 
user1804599
> This character acts as a placeholder, attempting to access it results in undefined behavior.
 
user1804599
4:06 PM
:(
 
@elyse C++11 says dereferencing end() on an empty string yields '\0'.
 
user1804599
oh nice
 
> >2015
> >C++11
 
@набиячлевэлиь It's not like it changed in C++14/17.
 
user1804599
49
Q: Take the address of a one-past-the-end array element via subscript: legal by the C++ Standard or not?

Zan LynxI have seen it asserted several times now that the following code is not allowed by the C++ Standard: int array[5]; int *array_begin = &array[0]; int *array_end = &array[5]; Is &array[5] legal C++ code in this context? I would like an answer with a reference to the Standard if possible. It w...

 
4:08 PM
yes
 
user1804599
wait, that's arrays, not vectors
 
@ThePhD Er, no, it does not.
s[s.size()] is zero, but the end iterator is not guaranteed to be non-singular.
 
"non-singular" ?
 
user1804599
ok
 
4:14 PM
@ThePhD Essentially dereferenceable.
 
I'll laugh if everyone here were just bots. Yeah, that would be funny.
 
I am.
@ThePhD As a rule of thumb, no end iterators are dereferenceable.
 
@R.MartinhoFernandes But what would end() point to except for &s[s.size()] ?
 
Xeo
nullptr.
 
But why would an implementation do that if its expected to always hand you... you know what, nevermind.
 
Xeo
4:17 PM
Or whatever else
Point is, standard guarantees nothing for past-the-end iterators
 
DeathStation 9000 would point to something else
 
@Xeo Well, the standard is a doodyhead. :<
 
I have a class that holds a simple value, like struct Thing<int> { int value; }. This class can notify subscribers every time value changes. Does it make sense to have the class send out a notification when its first constructed?
 
sure why not
 
Who the hell would have been subscribed to it when it is first constructed?
 
4:22 PM
good point
 
Unless, the subscription system is not watching the object, but a handle or a name to the object.
If the subscriptions aren't tied to the C++ lifetime of the object, then created / deleted messages would make a lot of sense.
 
no, no you have to explicitly subscribe. So you're right.
 
> Frogbert has left #loungecpp ["time to go to bedziemy"]
what.
 
The standard does the right thing.
*s.end() is always wrong.
You suck if you disagree.
It's the kind of code that should automatically fail CR
 
@R.MartinhoFernandes Yeah? YEAH?
WELL
You're right. :c
 
4:35 PM
Why would anyone *s.end()?
 
@ElimGarak because they're bad peopel
 
@ElimGarak they tried to get the pointer to the past-the-end element
 
> UB wizardry makes my code run .16% faster!
 
but that's wrong
they should specialize the code for contiguous iterators
and do the copy-from-the-buffer to the others
C++17 standard makes the first thing hard to do by not specifying contiguous_iterator_tag
 
user1804599
> error: there are no arguments to 'create' that depend on a template parameter, so a declaration of 'create' must be available
 
user1804599
4:37 PM
nice error message
 
quite understandable
 
I just tried generating project names, and it pooped out the name of the next iteration of OS X: "Moose White".
 
> TEST IRFUT
irta test fruit :3
 
send help
 
feel free to come over here -_-
 
user1804599
4:47 PM
shiny :3
 
> throw "fuck";
 
> DWORD
??
 
user1804599
Yes, because CBA to find system_error subclass libraries that support WinAPI errors.
 
if (access.count(file_access::write) && !access.count(file_access::append)) {
    creation_disposition |= TRUNCATE_EXISTING;
}
I question this design choice
 
boost::filesystem::path reminds me of their operator/ overload
Pretty funny stuff
 
user1804599
4:50 PM
@milleniumbug Me too.
 
Barraiya is a god in Australian aboriginal mythology who created the first vagina with a spear so that Eingana could give birth. == References... ==
 
@ThePhD shiny as fuck
 
user1804599
I could add another flag.
 
Should it truncate by default? On one hand, it's common to write to a file and disregard the content, on the other hand, it's not quite safe
 
user1804599
There are so many options for opening files and they differ greatly between platforms.
 
4:51 PM
Best. Project. Codename.
 
Nowhere I have specified I want to drop data
 
@ElimGarak LOL
"IT HAS NOWHERE TO COME OUT"
 
> I don't give a fuck. I throw it.
 
Stab.
 
The spear part must've been painful.
 
4:52 PM
Clearly.
You should save that name for a particularly painful project.
 
user1804599
Truncate-on-open-for-writing is quite usual for file opening APIs though.
 
Just read about Chronus, Gaia, and whatever the sky is (Uranus) in Greek mythology.
 
Ugh. Greek Mythos.
 
naming your projects after greek gods is so cliche
 
Just a bastion of what could probably take the cake for the most ornery, most assholish gods in existence.
 
4:54 PM
What about: if I specify write but don't specify truncate then if a file exists, throw
 
typing in the name of a greek god in github usually yields tons of results
 
user1804599
#define FLAG(name) enum class name : bool { no = false, yes = true }
 
@Prismatic highest cliche level: egyptian gods
 
....
quietly hides sol away
 
nah, greek gods are more common
egyptian gods are up there tho
 
4:55 PM
> Uranus imprisoned Gaia's youngest children in Tartarus, deep within Earth, where they caused pain to Gaia. She shaped a great flint-bladed sickle and asked her sons to castrate Uranus. Only Cronus, youngest and most ambitious of the Titans, was willing: he ambushed his father and castrated him, casting the severed testicles into the sea.
 
PLOOF
 
Didn't Aphrodite come from Cronus's balls?
 
@R.MartinhoFernandes Shiet.
In Australian Aboriginal mythology, Kinie Ger is an evil half-man, half-cat beast that hunts and kills the innocent with his spear, until he is himself killed in an ambush. == The myth == The Kinie Ger was a monster from Australian Aboriginal mythology. It was described as half human and half quoll (the quoll or native cat is a marsupial predator related to the Tasmanian devil and not a true cat). It was a ruthless killer with the head and body of a cat but the limbs of a man. It wandered around killing innocent people, birds and animals and was the terror of the bush. In the myth, the creature...
 
Literally, the sexiest woman alive was the sea foam from Uranus's severed testicles.
 
4:56 PM
Apparenty, Cat++ is an old, evil entity.
 
> Kinie Ger is an evil half-man, half-cat beast that hunts and kills the innocent
Sounds about right
 
user1804599
@milleniumbug why
 
s/Kinie Ger/Cat Plus Plus
 
user1804599
Opening for writing without truncating should be perfectly fine.
 
I can only imagine what the gods who touched Aphrodite thought. "I'm literally touching someone else's balls right now."
 
4:58 PM
> Uranus and Gaia then prophesied that Cronus in turn was destined to be overthrown by his own son, and so the Titan attempted to avoid this fate by devouring his young.
 
@ThePhD everyone formed from someone's balls
 
And that's why you never fart on a man's balls.
 
Abortion is for wusses.
Just eat the fuckers
 
user1804599
Also, append shouldn't be an access type.
 
@R.MartinhoFernandes I remember being disgusted by this a lot when I read it
 
4:59 PM
@elyse Not sure how would it work when not appending
 
Eating your kids is all sorts of fucked up
 
(overwriting the stuff that's in the file?)
 
user1804599
You seek to the byte you want to overwrite, and then overwrite it.
 
user1804599
Like the insert key in a text editor.
 
@Prismatic This is not nearly the weirdest thing in Greek mythology
 
4:59 PM
yeah now that reminded me that fopen flags for opening files are completely broken
 
Check out Europa
 
user1804599
Ah, I have a better idea.
 
lol my professor requires at least 6 "huge" queries in my DB project
 
Also Norse one is better
Look at fucking Loki
 
Problem is, all my queries are small and subqueries are now factored out into small functions for readability
So I'm fucked
 
user1804599
5:01 PM
If you don't want truncating, you just have to call CreateFileW or open yourself.
 
@CatPlusPlus Yes, but there's a painting of cronus eating his kids or something that I remember I found very disturbing
Its just one of those things that gets stuck in your brain
 
user1804599
I'm not going to worry about all possible use cases for something that is a utility convenience API.
 
It's like if a C professor required you to have huge main and use just a couple of functions just to show that you are able to define ones.
 
Like, the very first paragraph here en.wikipedia.org/wiki/Loki
 
Wait. Not Europa.
 
5:02 PM
> decided to seduce or ravish her, the two being near-equivalent in Greek myth
 
In Greek mythology, Pasiphaë (/pəˈsɪfɨ.iː/; Greek: Πασιφάη Pasipháē, "wide-shining") was the daughter of Helios, the Sun, by the eldest of the Oceanids, Perse. == Family == Like her doublet Europa, her origins were in the East, in her case at Colchis, she was the sister of Circe, and she was given in marriage to King Minos of Crete. With Minos, she was the mother of Acacallis, Ariadne, Androgeus, Glaucus, Deucalion, Phaedra, Xenodice, and Catreus. She was also the mother of "starlike" Asterion, called by the Greeks the Minotaur, after a curse from Poseidon caused her to experience lust for and...
 
@CatPlusPlus Loki: father, son, wolf, stallion.... ... wait, what, Mother & mare...?
> in order to actually copulate with the bull, she had the Athenian artificer Daedalus construct a portable wooden cow with a cowhide covering, within which she was able to satisfy her strong desire.
Fucking greek myth.
 
Engineering.
 
I hope my career doesn't end with making sex horses.
 
@ThePhD Yep
 
5:05 PM
 
Old religions were awesome
None of that wishy-washy 'god loves you' crap
 
@ThePhD Wait, Deadalus as in father of Icarus?
wtf was he doing making sex horses
 
Maybe she paid him like really well
 
he was the designated inventor guy
 
was this before or after Icarus flew to high
 
5:08 PM
SON, CHECK THESE SWEET WINGS OUT
 
The Original Porn Site Programmer
 
user1804599
ohboy
 
user1804599
I'm gonna deal with C++ I/O streams now.
 
rip elyse
 
5:08 PM
@elyse Boy howdy, what fun!
 
I never use streams. What's so bad about em
 
user1804599
Since I only deal with bytes, not text, I suppose I should wrap streambuf, not istream?
 
@Prismatic MSVC's implementation is whats bad about them
 
His tomb will read "He was annoying with all this scala shit but enjoyable nevertheless"
 
user1804599
I don't really understand what istream and ostream are for.
 
5:10 PM
@elyse They're for the user to use, or maybe I don't understand
@elyse I guess.
There aren't a lot of useful streambufs in the wild anyway, so maybe just don't use iostreams
 
@jaggedSpire before. Be was tasked to build the Labyrinth afterwards to put the Minotaur in, and then imprisoned within with his son to make sure no one knew the way out. Then he did the wings thingy.
 
user1804599
@Mr.kbok I want to write interop between my library and iostreams.
 
Basically, everything Daedalus made turned out bad for him.
 
@elyse but why T.T
 
user1804599
So that you can use it for example with other C++ libraries.
 
5:12 PM
@elyse Like I say, I don't know of any lib that provide/use iostreams
 
user1804599
LLVM.
 
oh k
 
@R.MartinhoFernandes I suspect his life would have gone much better with NDAs. No one would know he designed the Labyrinth, and no one would know he built a sex horse.
 
yes, the sexy horse is a french cabaret
 
5:13 PM
oh hey, that is a cow. I got caught up in the whole "sex horse" talk.
 
@jaggedSpire Except the guy who hired him, of course
 
@jaggedSpire Minos knew since he hired him.
 
@Borgleader of course, but who would want people to know they wanted a sex cow? And the stuck-in-labyrinth thing was apparently so he couldn't be interrogated for the solution. No one but the guy who asked for the labyrinth knows who to ask, no problem.
Does anyone else find it weird that it was translated as labyrinth instead of maze?
 
no
 
considering labyrinths are usually made of a single winding path and are therefore impossible to get lost in
 
5:17 PM
that is not a labyrinth
 
@jaggedSpire In my language, a maze translates to "labirint".
 
@ElimGarak huh
 
It's pretty shitty, also, formally it is "lavirint".
 
Anybody has a good diagram editor to recommend?
 
this is what I'm talking about
 
5:20 PM
that is not a labyrinth.
that's just a really bad maze
 
No, I'm pretty sure that's what I was taught was a labyrinth in school
 
that's a maze
 
@jaggedSpire Then your school was defective
 
5:21 PM
That looks like what I would call a labyrinth
 
It can be whatever you want it to be. I hereby proclaim that a "zbrka". But yes, a labyrinth.
 
9
Q: Difference between "Labyrinth" and "Maze"

SF.I know the two are pretty much synonymous: labyrinth a complicated irregular network of passages or paths in which it is difficult to find one’s way; a maze maze a network of paths and hedges designed as a puzzle through which one has to find a way a complex network of path...

 
Oh. TIL I guess
 
@elyse sure
it contains the actual input/output behaviour
 
Nobody really observes the difference, so it is pretty much pointless. My language literally doesn't recognize the difference formally.
 
5:24 PM
^
 
After how many elements do you guys think its a good idea to use a set over a vector for faster lookups (rule of thumb?) ignore insertion/removal/other operations
 
It's funny because looking up the definition gives pretty much the same one as maze, but looking at images gives only gives unicursal images
 
@Prismatic A thousand or more, maybe?
Even higher if the vector is sorted.
It also depends: how expensive are the comparisons?
 
Oh, Djangooooo
 
Is it dirt-cheap integer comparisons?
Or is it something more expensive like long strings?
FWIW, I usually air (heir?) on the side of caution and just use sets anyways.
Albeit most of my sets turn out to only have like 4-10 elements.
 
5:29 PM
Boarding a plane back to JFK airport.
@ThePhD Err.
 
At least, in my debugging scenarios.
When I crank through the real shaders 'n' stuff it's gonna be hyooge.
 
@ThePhD err on the side of caution
err as in errand
 
err as in error
 
Err as in Loungerr.
 
Jul 16 at 14:01, by milleniumbug
"Lounger" sounds like a type of sandwich
 
5:32 PM
@milleniumbug "Footlong" sounds like a type of penis
 
especially "Longdong"
long dong;
 
volatile and prone to shrinkage
 
volatile long dong;
better use const long dong = 42;
 
I'm not gonna like this semester at school.
There's gonna be no programming classes, again, because I've been exempted from all of 'em.
 
this sucks
 
5:34 PM
Only things left are at the top level.
Like Computer Animation and Computer Vision and stuff.
 
The đồng (/ˈdɒŋ/; Vietnamese: [ɗôŋm]) (sign: ₫; code: VND) has been the currency of Vietnam since May 3, 1978. Issued by the State Bank of Vietnam, it is represented by the symbol "₫". Formerly, it was subdivided into 10 hào, which was further subdivided into 10 xu, neither of which is now used. == Etymology == The word đồng is from the term đồng tiền ("money"), a cognate of the Chinese tóng qián (Traditional Chinese: 銅錢; Simplified Chinese: 铜钱). The term refers to Chinese bronze coins used as currency during the dynastic periods of China and Vietnam. The term hào is a cognate of the Chinese háo...
 
Man, with my dong, I'd be rich in Vietnam.
 
@melak47 Now make it static_switch.
 
does it actually give you anything over if?
oh wait, it does
 
5:39 PM
@milleniumbug does not fail if you write impossible stuff in the else :)
 
the functions are templates
 
@ThePhD ._.
 
@melak47 :3
 
yeah that works
 
FWIW I do something similar.
Starting from here, heading north.
 
5:40 PM
Do you even template, brah?
 
It's basically an if-tree. I should simplify it, though.
 
@ThePhD that looks like regular tag dispatch?
 
@melak47 Not quite.
I could make it regular tag dispatch if I made a direct_tag, compatible_tag, code_point_tag and a none_tag, and then used a std::conditional or something.
And then I could just overload behavior based on that, rather than going down a list.
 
@R.MartinhoFernandes that's a big dong
woah, ten ho per dong?
 
@ThePhD actually, a fully static switch (without silly fall-through) should be similar to this, right? coliru.stacked-crooked.com/a/70b96a5006736725
 
5:45 PM
posted on September 07, 2015 by Scott Meyers

If I want to define a local int variable, there are four ways to do it: int x1 = 0; int x2(0); int x3 = {0}; int x4{0}; Each syntactic form has an official name: int x1 = 0; // copy initialization int x2(0); // direct initialization int x3 = {0}; // copy list initialization int x4{0}; // direct list initialization Don't be misled by the word "

 
black people are monkeys... just no more so than white people or any other human being
 
@Puppy ergh... sort of
 
humans and monkeys descend from a common ancestor, but that common ancestor was not a monkey
 
@melak47 Right, except now it should be done with functions!
 
5:48 PM
yeah, same crap as above. stuff functions into tuple, select & execute correct one by index
 
Mmhmm.
That's what I need to do to drop some of the boilerplate in my code.
 
what's it useful for again? :D
 
Mostly to drop the boilerplate internals.
But I think my implementation will be fine-enough for now.
 
or, actually...might be simpler/easier with the overloaded lambda trick
just tag dispatch, but inline with lambdas
 
Like a static variant visitor.
 
5:50 PM
yeah, without the variant :D
 
testing stags on g++
 
I should stop messing with this
and get back to OpenGL stuff.
 
@Puppy Said the black and white puppy!
 
mess is fun :p
 
@melak47 You're just trying to drag me in. ;~;
 
5:51 PM
train stop coming up
I'll be back in ~15 and expect this to be working :p
 
What, noo.
I have to go eat. ;~;
I haven't eaten all day!
 
fiine
 
Also... hey @sehe, what would it cost to get, like. One of those swooping code reviews from you?
On a git repo or part of a public git repo.
 
lol Vlad is suspended for voting irregularities
 
> News: In the ACCU Overload #126 (April, 2015) there is published my article "iterator-pair - A Simple and Useful Iterator Adapter". I hope it will be interesting for C++ programmers.See it here You may leave your comments to the article in this thread
a.k.a. ranges
 
5:54 PM
    // ugly
    ks::shared_ptr<raintk::Widget> widget =
            ks::make_object<raintk::Widget>(nullptr);

    widget->width.Assign(100);
    widget->height.Assign(100);
    widget->position.Assign(glm::vec3{1,2,3});


    // nice but not possible/practical
    ks::shared_ptr<raintk::Widget> widget =
            ks::make_object<raintk::Widget>(
                nullptr,
                {"width",100},
                {"height",100},
                {"position",glm::vec3{1,2,3}});
 
width.Assign(100);
why
 
@Prismatic auto bitch
 
where would I use auto?
 
top line
 
auto widget = ks::make_object...
 
5:55 PM
@Prismatic there's this operator=. I wonder what it does
 
@Mr.kbok you can set a property to a value, or a function. I use Assign and Bind to be explicit about the two since they do different things, I might change it up.
 
er no.
 
widget->width = 100; afaik fairly explicit whats going on
 
@Prismatic fair enough, but = should be a shortcut for Assign imo
 
With templates, you can check is_callbable<T> and if its true default to bind.
 
5:58 PM
don't do it
 
is_babble
 
what if a property is callable
 
user1804599
Don't introduce special cases.
 
always return true
 
But, even then, if you just had a templated operator()( Args&&... args ) you wouldn't need it in the first place.
Unless, you're type-erasing things inside, in which case, uh.
I dunno.
Stuff that shit in a wrapper and make it Do The Right Thing™.
 
5:59 PM
constexpr bool is_my_code_shit() { return true; }
 
@TonyTheLion CONST RETURN TYPE AAAAH
 
change to constexpr so it can be used in template context
 

« first day (1787 days earlier)      last day (3160 days later) »