« first day (1018 days earlier)      last day (4156 days later) » 

15:00
@ThePhD I wonder if I could prepare the irradiance map on the CPU and then make a 3D texture from it to render on gpu then.
Hmm, should have linked to "Lacrimal apparatus" instead.
I'm really curious about why one would want that.
@R.MartinhoFernandes js developers can't C++
@BartekBanachewicz Shrugs. I dunno.
15:13
> In humans, the tear ducts in males tend to be larger than the ones in females.
That's why men don't cry: when they do, it's messier.
If you don't find that funny, be glad I didn't make the follow-up joke.
yeah, sums things up well :D
my friend made a guy cry ... she talked to his boss in front of him about a piece of work he should have completed in order for her to complete hers
The Messier objects are a set of astronomical objects first listed by French astronomer Charles Messier in 1771. Messier was a comet hunter, and was frustrated by objects which resembled but were not comets, so he compiled a list of them, in collaboration with his assistant Pierre Méchain, to avoid wasting time on them. A similar list had been published in 1654 by Giovanni Hodierna, but had no impact and was probably not known to Messier. Lists and editions The first edition covered 45 objects numbered M1 to M45. The total list published by Messier finally contained 103 objects, but the...
you know what grinds my gears. Sites that insist on formatting the content so that is narrower than a ants cock
@ThePhD you never explained stack_cast.
15:20
@R.MartinhoFernandes <3 I'll keep it to myself. :D
@R.MartinhoFernandes o_0 is it as bad as It sounds?
@ThePhD is it valid C++?
You guys hate cowboy_cast, why would you want stack_cast ?
You can't just name drop that shit and bail out.
15:21
@BartekBanachewicz ... Define "valid" ... >_>
@ThePhD valid according to the C++ Programming Language specification in 2011 version
hint: UB is not valid.
Um.
Yes?
@ThePhD It's mostly the constant insistent spamming that annoys me.
@ThePhD then why are you afraid of showing it?
@ThePhD there's a major difference between "wanting" something, and "wanting to see what something is"
I am curious to see what it is. But I can probably promise you even without having seen it, that I will not use it in my code ;)
JBL
JBL
15:23
What the hell is cowboy_cast anyway.... ?
@JBL cowboy_cast is not a valid C++ code
I like the comment though
@JBL a stupid name for the union type-punning trick
Only the best of o' ya'll sugar cubes can handle this here rootin' tootin', bad boy, yeee haww
something like that :D
Personally I think the comment is the worst part.
15:24
I say it out loud multiple times when waiting for something to finish loading, etc.
Ahahaha
@R.MartinhoFernandes :D The comment is the best part.
@ThePhD <3
The creator knows
Shut it and show us stack_cast.
@ThePhD it was, IIRC, "I write terrible code and I'm proud of it"
15:25
@ThePhD I thought you were still thinking that one up?
He told me about this cast when he was here.
We should send cowboy_cast to everywhere @ThePhD sends his CV
@TonyTheLion I finished stack_cast on the plane. <3
JBL
JBL
@BartekBanachewicz Code anywhere ? I'm afraid of looking at it, but also terribly curious now...
@BartekBanachewicz I already have shown it at work. :D
15:26
@ThePhD seriously? I told you not to.
@JBL I got a pic saved
One sec
@ThePhD neat. I never get any coding done when I'm on a plane :(
@ThePhD Just show it.
@JBL so you know what union type changing is?
Neeeveeer.
15:26
Oh you suck
@JBL aw shit, it's on my PC, you'll have to wait a bit
Come on, you guys will just make fun of me for like 20 years again. ;~;
Meh, I'm starting to suspect it's vapourware now.
JBL
JBL
@BartekBanachewicz Yep
@ThePhD ... we're doing that anyway :p
15:27
@ThePhD Its not like that isn't already happening?
@R.MartinhoFernandes I'm starting to suspect "I desperately need to attract attention to myself"
@ThePhD We promise we will. Now, show it! :D
Ell
Ell
telling someone they have issues over and over will only make them worse >.<
15:28
^
@Ell fine, I won't say a thing.
JBL
JBL
@BartekBanachewicz He did messy things using that ?
hopefully that it will make it better
@ThePhD As if that's going to be a substantial change of plans.
@JBL write to one member, read from other member.
UB
15:29
@JBL Well, my PC won't boot up, restarted it 3 times so far. I'm restarting it with my middle finger now.
@JBL messy? it's simple. If you write to one union member and read from another, it's UB
... and it worked
@JBL no. He just named it cowboy_cast, and wrote it with some childish code comments. That's all, really
JBL
JBL
15:29
@jalf Oh ok
Meh.
@JBL Wait for the real picture. :D
@BartekBanachewicz What? Always? I do exactly that for protocol decoding.
@MartinJames always. so TYL your programs have UB
@MartinJames C++11 provided some rules that make it slightly less than always, but they're so complex you'll never remember them and they basically never come up in practice.
@MartinJames UB according to the language. All major compilers explicitly define its behavior and guarantee that it will work
15:30
Is it valid in C99 or something?
So it really just depends on how pedantic you are
@Tuntuni Nah, UB there as well
Damn
@jalf I'm pretty sure that Clang only defines it if you have -f-no-strict-aliasing, and MSVC doesn't officially define it at all.
@DeadMG I'm pretty sure you're wrong on both counts :)
@BartekBanachewicz Typically, one union member is a byte array. The other is defined byte-by-byte by the protocol spec. They are packed structs. I can't see the UB from 'ere :)
15:31
@jalf Well, Clang is just my vague memory, but I asked STL about this exact issue at Bristol, so I've got a pretty reliable source here.
well, MSVC doesn't do strict aliasing analysis at all, so it's safe by default. I'm nearly certain Clang explicitly allows it
That, and my code works.
@MartinJames irrelevant
@MartinJames the fact you don't see it doesn't change a thing.
he said that MSVC does not officially define any strict aliasing or unioning shenanigans, but because they have a bunch of Windows kernel code that depends on that stuff, they wouldn't be able to do strict aliasing analysis without breaking all their own code, so it was basically guaranteed to never happen.
15:32
@DeadMG ok, so I guess the correct phrasing would be "MSVC makes no official guarantees about it, but with the current compiler implementation, it is safe" (which, I admit, is a much weaker guarantee than what I initially said)
Shut up and let him show the new one.
@DeadMG You met STL in person? woot
Forgive me if I consider workingness useful :)
@jalf Yeah, the unofficial guarantee is pretty strong though.
@MartinJames there are other solutions that work and are not UB
JBL
JBL
15:32
I'm starting to get a better picture of @ThePhD as time passes.
@JBL and that is?
I have one on my phone
JBL
JBL
@BartekBanachewicz An overly excited child who types code.
well, here's cowboy_cast @JBL
15:33
@JBL it's somehow comforting I'm not alone in my views.
JBL
JBL
@Tuntuni What the....
@JBL I know... it's awesome, isn't it?
eyes bleed
@BartekBanachewicz There are indeed - often I use a byte-by-byte state machine. Still, I'm failing to find the UB in several of my embedded protocol encoders/decoders after decades. I'm happy with that class of UB.
@MartinJames Yeah, for all the major compilers it would simply break too much existing code if they did not define it.
15:35
@MartinJames UB is not about works or doesn't work, ugh. Your particular platform supports it, so what? The language explicitely states anything can happen.
GCC still doesn't come with is_trivially_copyable :/
@MartinJames And if you are happy with "my code can sometimes work and sometimes not", that's fine with me, sure, do that.
JBL
JBL
@Tuntuni I like the idea of sending this piece of code everywhere he applies for a job.
because it doesn't have to be the platform change. It can only misbehave on first friday of september.
@BartekBanachewicz Have you not read anything that was written here in the past ten minutes?
JBL
JBL
15:36
What would be even better is a video of the interview.
@BartekBanachewicz That's the thing - I don't get any protocol errors.
@JBL Pretty sure they would hire him immediately once they saw it.
@R.MartinhoFernandes i did, why?
@BartekBanachewicz what if you are happy with "my code is sure to work on every compiler I care about"? :p I agree, the UB-ness of this is something to be aware of, but as long as major compilers guarantee that it works, let's not exaggerate the "it might suddenly break" thing
JBL
JBL
15:37
@Tuntuni Depends if they want UB everywhere in their code.
It's the code that's supported as legacy.
@JBL :D
If you have legacy codebase with that, meh, prolly not worth it.
UB just means "not defined by the C++ spec". It does not necessarily mean "not defined at all, by anyone, anywhere". If your compiler defines it, then the behavior is well-defined under that compiler
But for fucks sake, don't write code using it now.
@jalf I am perfectly aware of what UB means, TYVM.
15:38
@BartekBanachewicz you're welcome. :)
frankly, the only reason the C++ spec does not define it is that they're afraid of optimization inhibition in some other cases that would be affected.
You're probably relying on implementation-defined behaviour without even realising it.
JBL
JBL
@jalf Makes me think : this would be a non-standard compliant compiler then ? What could be the use for that ?
Ell
Ell
People are insecure on here about knowing things o.O
If you tell someone something they already know, they go "I already knew that thank you very much"
@CatPlusPlus I am relying on it, but I have it abstracted and checked.
15:39
@CatPlusPlus My personal bet is that there's undefined behaviour in almost all codebases of reasonable size.
What annoys me the most is that I still don't know what it is useful for, besides inspecting IEEE754 floats directly (for which I have alternatives that don't raise any of this pedantry)
@JBL legacy code
There are parts of C++ spec which are undefined just because.
JBL
JBL
@BartekBanachewicz For something that "became" UB in a new standard I suppose ?
If my compiler did not support the packed pragma, I would not use unions to decode protocols.
15:40
@JBL not at all. The C++ standard says "I have no clue what might happen if you do this, and I impose no restrictions on what may happen". Which means that the safe, deterministic behavior that the compiler implements is perfectly legal, because it is a subset of the "anything" that the C++ spec says may happen
@JBL more like for people writing dumb code.
@DeadMG Null pointer dereferences, uninitialised reads, or any kinds of segfaults that don't segfault because luck (like tiny buffer overflows) are all over the place.
the compiler didn't reject that. so the code stayed there.
@R.MartinhoFernandes Pretty much the only thing I've seen it used for is packing and unpacking various things. I gotta admit that I don't really know what it's useful for either.
JBL
JBL
15:41
@jalf Oh that makes perfect sense indeed.
And I really hopefully would like to see C++14 making it either explicitely defined or simply not legal to the point of breaking build
ISP cannot decide whether their peak/off-peak hours are given in GMT or BST. When asked, a two-day conversation had them flipping back and forth between the two. Then this:
> I can confirm that we work on BST for our usage. In regards to previous responses, I'm not sure if my colleagues were aware of the difference between the two, and for that I can only apologise.
It's not possible to detect.
Because C++ unions are untagged.
well it's not like C++ has the best type system on the planet, agreed.
@BartekBanachewicz I honestly don't care, because of dubious usefulness; see above.
15:42
@R.MartinhoFernandes yea. but that would at least stop bullshit talks about it.
I don't remember ever using unions.
I haven't used them either
They were useless in 03 and are only slightly less useless in 11.
._.
15:43
@BartekBanachewicz Not really.
I can't do it. :c
@CatPlusPlus You done much protocols/driver/assembler interop?
@ThePhD It can't be that bad.
@ThePhD can't do what?
I'm pretty sure it segmentation faults.
JBL
JBL
15:43
@BartekBanachewicz Still doesn't want to show stack_cast, mmh ?
@MartinJames Serialisation implemented with unions is fragile at best.
@JBL still being a drama queen, mmh?
@ThePhD Pleaseeeee.
JBL
JBL
@BartekBanachewicz A bit.
(Even without mentioning the blatant UB)
15:44
@BartekBanachewicz People would still talk about "blah blah but only on C++14 blah blah"
@ThePhD so why did you bring it up in the first place?
@R.MartinhoFernandes that's plenty enough reason to punch them in the face, at least.
@ThePhD Then there's nothing to laugh about.
@CatPlusPlus OK, then it's a shame it works so well.
9 mins ago, by Bartek Banachewicz
@MartinJames UB is not about works or doesn't work, ugh. Your particular platform supports it, so what? The language explicitely states anything can happen.
15:45
@MartinJames How do you use it for that?
JBL
JBL
@ThePhD At this point, what prevents you from showing it ... ?
@R.MartinhoFernandes By exploiting the crappy type unsafeness.
@BartekBanachewicz We get it. You still don't get that it works everywhere.
@CatPlusPlus For what?
I honestly don't get it.
@R.MartinhoFernandes doesn't work on Hell++
(De)serialisation from bytes to types.
15:46
ugh really.
Ell
Ell
it's ub to write to one member of a union and read from another isn't it?
read the last hundred messages
@CatPlusPlus You mean it's always union { T t; char raw[sizeof(T)]; }?
@R.MartinhoFernandes I don't know if always vOv he mentioned protocols, so this is what I imagine.
15:46
Just to add to the horrors - I have huge packed unions of structs for the various message types on my CANBUS protocol, including bitfields where I have to ensure that those fields are divisible by 8 :)
.. how can i force an object out of scope? e.g. I want to test it's destructor method
@MartinJames yeah, we all know already you write terrible code :)
Also yeah packed structs all over the place probably.
@MartinJames But do you ever write to one and read from another?
15:47
@EiyrioüvonKauyf { Object o; }
Just ugh.
q_q
@BartekBanachewicz done :L i even did {{ object o; }}
I had to format it so it fit on the screen.
IT'S NOT MY FAULT
I WILL NOT BE MADE FUN OF
YOU ASKED FOR IT
The lack of type safety in unions is disgusting.
15:48
I can understand unions to do some sort of variant thingy, but that's not at all type-punning.
so basically it's cowboy_cast but you implemented the union yourself, and wrote a bunch more comments that make the code almost unreadable
@R.MartinhoFernandes Sure - the driver blows bytes into the byte array, the higher-level stuff reads the various fields.
@ThePhD um, does it simply move the pointer to random place in memory?
@BartekBanachewicz Random places in the stack.
It's hard to write structured data!
15:49
@ThePhD What is it even supposed to be?
@ThePhD how is that different from void* ptr = rand(); ?
@BartekBanachewicz That could be heap memory.
@MartinJames Meh, that sounds like what people would do with memcpy.
@ThePhD yeah but really what's the practical difference?
The difference here is that in select case for which the stack is sufficiently big, stack_cast can theoretically not fail.
And return a valid value.
@R.MartinhoFernandes I don't copy data if I can avoid it, especially in drivers.
@MartinJames why can't you use POD memcpy?
JBL
JBL
I spotted a little suicide_cast in the corner.
It's not even laughable.
It's just random shit.
Stack memory is completely different than heap memory!
15:50
@MartinJames The driver does.
@R.MartinhoFernandes Well, who's fault is that? >_>
@MartinJames "especially in drivers" and what makes drivers so special, eh?
It's nowhere near the sort of thing done with ThePhD's cowboy_cast.
It's "normal".
2
Yay, I wrote normal code~
It's imperative to write drivers in low-level, crappy languages, so they have a lot of bugs and BSOD often.
15:51
@ThePhD Really, it's just ridiculous.
Well, okay. I'm fine with that then. :D
I thought it did something.
@CatPlusPlus s/imperative/dumb industry mainstream/
I can write random silly code too...
@BartekBanachewicz They do not need to do protocol decoding, only need to stuff bytes into *buffers, queue the *buffers and signal a semaphore.
15:51
At least cowboy_cast has a goal, even if it's a misguided one.
@MartinJames stuffing bytes is copying FYI
Therefore it's important that the byte buffer is used in a deserialisation scheme that's completely type-unsafe!
This "stack_cast" thing... is just random.
(And unaligned buffers)
@CatPlusPlus aye. Because you know, ~drivers~
@R.MartinhoFernandes It gets you the value of TTo based on what's inside the current function call's stack. :D
However, it's still segfaulting...
At least, most of the time.
15:53
@ThePhD It... doesn't. It might as well be return rand();.
4 mins ago, by Bartek Banachewicz
@ThePhD how is that different from void* ptr = rand(); ?
@BartekBanachewicz No. All the bytes are read from the same location.
@ThePhD my main objection to that monstrosity is the same as with cowboy_cast. Take your code seriously. Don't write comments to be funny. You either believe the code is useful, or you don't. In the latter case, don't write it. In the former case, treat it as useful code, give it a useful name, and make sure that any comments you write are useful.
@MartinJames ugh, I don't get it really. Under strict aliasing rules you can read data directly to the POD type.
@ThePhD Of course it is segfaulting. Despite what you believe, it doesn't get you stuff from the stack. You just wrote random crap.
15:54
@R.MartinhoFernandes It totally doooes. ;~;
Taking my code seriously? What am I, a serious person?
You didn't even try to achieve the silly goal you set for yourself.
@ThePhD It does not.
Oh yeah?
I'll, you just wait
I'll make it back-retrieve a float off the stack!
that's so much suckage
15:55
@ThePhD (I am telling you that, and your memory manager is telling you that as well.)
I wrote a generator for enterprisey Python code that multiplied two numbers in 4000 lines of code.
Once.
Just because.
you must've been really bored
It was almost like C++ metaprogramming, but more understandable.
@CatPlusPlus did it run a minecraft server and make a redstone circuit in the process?
@ThePhD What's roulette_cast?
15:56
@Tuntuni I don't know what you're talking about.
No, it was glorious high-level code, not some electronics emulation shit.
you know what's amazing?
@CatPlusPlus how did it do it...? manually implementing addition using bit ops isn't 4000 lines
That all this code, cowboy cast, stuff like this resides in his Engine~ 's code
JBL
JBL
@Tuntuni And suicide_cast ?
15:57
@ThePhD Come on, these are awesome.
@JBL Yeah, that one too.
JBL
JBL
Oh well, any of these could be named suicide casts.
@Tuntuni what does "awesome" mean for you?
Do you think going 800k back on the stack will be safe?
@BartekBanachewicz Something very weird.
@R.MartinhoFernandes I don't think I wrote it to be safe.
15:58
8 mins ago, by Cat Plus Plus
Stack memory is completely different than heap memory!
@Tuntuni you know that's not the typical usage of word "awesome" in the typical english language
STILL.
@ThePhD Try different values and tell me when it will be safe.
Let me try something.
stand back people.
JBL
JBL
15:59
@ThePhD Duck and cover !
he's going to code.
3
@R.MartinhoFernandes When it reaches 11.
typedef struct{
U_CAN_ADDR CANaddr; // 4 bytes
CANDATA canData; // 8 bytes
}FRAME_0_CANDATA; // 12 bytes

typedef union{
BYTE dataBytes[Cf0DataSize]; //12
FRAME_0_CANDATA f0CanData; // 12
} ALL_FRAME0_BODY_TYPES;

typedef struct{
FRAME0_HEADER header; //9
ALL_FRAME0_BODY_TYPES body; //12
} FRAME_0;

typedef union{
FRAME_0 f0Data;
BYTE frameBytes[CfxDataSize];
} MESSAGE_DATA;
@MartinJames yeah, that's the terrible UB code you told us about.
Yes, we know how this crappy type-unsafe union shit looks like, thanks.

« first day (1018 days earlier)      last day (4156 days later) »