« first day (1865 days earlier)      last day (3066 days later) » 

user406009
8:00 PM
@orlp Wait, UTF8 string literals are C++11.
 
Even if there's an implementation where character literals are not ASCII-compatible then do you really care
 
@Lalaland not according to cppreference
 
user406009
(Since C++11)
 
user406009
The character literals are C++17 of course.
 
user406009
8:02 PM
But the string ones are C++11.
 
u8"a"[0] is totally reasonable.
 
user406009
But Cat is probably right here.
 
Wait: 0[u8"a"], even better.
 
user406009
If you are going to worry about non ASCII-literals, then you pretty much have to give up on everything.
 
static_assert if you really want to be safe against this mythical creature
Also goddamn the amount of string types in WinAPI
 
user406009
8:05 PM
@Morwenn If by "better", you mean unreadable.
 
@Lalaland What? It's obvious that the leading 0 hints at considering only one character, right?
 
@CatPlusPlus Meh, you can just use LPWSRTPFBT_U_NFGL_STR for most things.
 
I need to know actual types for FFI
 
pretty sure that they are typedefs that can never change because people did stupid things to them
 
Yes and I need to know what they resolve to
 
8:24 PM
that's what Go To Definition is for ;p
IIRC there's a table on MSDN somewhere
 
Ell
Why do you need to know what they resolve to?
 
@Ell for FFI
do people not read?
 
Ell
that doesn't answer the question
why can you not do FFI without knowing what they resolve to?
 
stop asking questions!
 
I remembered the days when each SDK implemented its own string libraries ...
 
8:27 PM
@MartinJames Is that seriously a thing?
 
@Jefery no (Google it)
 
@Jefery Nah! Just cat-winding:)
 
You never know
 
@Morwenn I never understood why you could do 0[a] instead of a[0]
 
@Borgleader they are the same
 
8:32 PM
@Borgleader Because a[b] is *(a+b).
 
because compiler writer laziness and also it's required by spec and also because addition is associative.
 
@Ell Because the other side cannot interpret LPTSTR into an actual thing.
 
I might just start fucking with people and try to stick to index[array]
 
Ell
@Puppy but can't you just store it in a character array big enough?
or an integer big enough
 
no.
 
Ell
8:34 PM
You know it is some opaque thing
 
for one, that's MAGIC_BUFFER_SIZE, and there's no way to know that you got the right buffer size.
and for two, it could be passed in a register or someshit.
and for three, what the fuck would you even do with it when you had it? You have no idea what operations are legal or how to do anything.
 
Ell
@Puppy I understand you can't to anything with an arbitrary something
I just don't understand how the implementation would look different whether you knew the underlying type
 
well, let's see.
you might pass it in a register, or on the stack.
 
Ell
right
 
you might reserve 10 bytes for it, or 100 bytes for it.
you might call a destructor on it, or you might not.
you might de-reference it as a memory address, and you might not.
 
8:38 PM
It's a contract and both sides have to know the terms of it
 
that's just four things off the top of my head.
 
Ell
these things you know from looking up LPTSTR rather than looking up uint64_t though, right?
 
both cases apply equally.
you can't do fuck all until you have figured out the underlying type.
 
Ell
how does knowing that LPTSTR is something help you decide whether you can dereference it or not?
 
because if it's a double you're pretty much guaranteed to get a segfault.
 
8:39 PM
It helps the calling side generate correct byte sequence
 
@thecoshman I know they do the same thing, but when I read a[0] it makes sense, but when I read 0[a] it doesnt. Maybe its just me idk...
 
if it's a char* you might actually get something meaningful on the other end.
 
I don't understand the confusion
 
@Borgleader you're just used to that convention
 
Ell
@Puppy You would never dereference it in the first place
 
8:40 PM
If you use wrong type, you get garbled mess
It's really not difficult
 
@Ell Exactly my point. If you know it's a double you would not attempt to de-reference it.
but that requires that you know it's a fucking double.
 
Ell
@Puppy No, if you know it's a PageSize you know not to de-reference it
 
Are those degrees in pedantry angular or thermal?
 
What is this discussion even about
 
dunno really
 
8:41 PM
 
3 mins ago, by milleniumbug
It's a contract and both sides have to know the terms of it
that's my stance on this
 
@ElimGarak wtf is that? I give it a click and it didn't tell me
 
@Ell No, you don't know shit. PageSize? That could be anything. For all you know, it's a pointer to a big-integer structure that you should de-reference.
 
@CatPlusPlus sup moo
 
Ell
8:43 PM
@Puppy no you not to dereference it because the documentation of PageSize says that you can only add and subtract it
 
oh wow, been a while since I've seen him around
 
@Ell Compilers can't read documentation.
function calling ABIs do not read documentation.
 
@Ell ffs, what part of "you don't know what type something is, thus don't know what is safe to call" don't you get?
 
@thecoshman He comes in once a month or so
 
and furthermore, how the fuck would you even implement addition or subtraction?
integer operation? floating-point operation? call for custom overloaded operator?
 
8:44 PM
@ElimGarak He's dead to me!
 
Ell
@Puppy which is why c typedefs suck sometimes
 
@Ell Try writing a procedure in assembly and try to FFI it with C
 
@Ell They serve their given purpose perfectly well.
 
Ell
@Puppy why would you implement that? isn't the point of FFI so you don't have to reimplement the thing your interfacing with?
 
the contract here is named "calling convention" and there's a list of responsibilities calling side has to do, and the list of responsibilities caller has to do.
If any of these is violated the results are unpredictable
 
8:46 PM
@Ell Yes, but that does not include re-implementing absolutely every primitive type used in every call.
if you have a hypothetical PageSize length(), then you may implement length, but the caller has to know what the fuck to do with PageSize.
 
Ell
oh wait
I misread
 
Hey, you know what's more fun? ANYTHING
 
Anyway PWSTR is just wchar_t* turns out
 
Ell
@Puppy and they can do whatever is defined be the interface of PageSize, like toDouble(PageSize) or w/e
 
@Ell Only if you actually know what the fuck PageSize is so you know what interface it has.
 
8:48 PM
@Ell who's they and who are they calling
 
is "they" a caller of length() or the callee
 
Ell
@milleniumbug they is the programmer using PageSize
the caller
 
but it's not a programmer.
it's a compiler.
the compiler is generating the code to call a function which returns a PageSize.
the programmer has nothing to do with it.
 
Ell
well how does that happen? :P
I thought the point of opaque types was that you weren't supposed to know the underlying type
 
8:50 PM
that does not extend to literally every type in your API.
 
well, it's API vs ABI thing
 
you only make a few special types opaque.
and furthermore
 
they're not actually opaque.
you just define them as being, say, a pointer to something.
 
ctype for ASCII only
 
8:50 PM
then the caller knows exactly how to take and return them.
 
Ell
I don't get that though, the caller shouldn't know
 
and furthermore, the very fact that the caller must know what they're dealing with to do things with the thing is the very thing that makes opaque types work, because otherwise the caller could do anything.
 
Ell
the caller should only use the functions provided by the api
 
the caller cannot use the functions without knowing.
 
Ell
I know that
I just don't understand how the compiler can make assumptions about the opaque type, whatever the underlying type
for example if you have it as a pointer, the compiler can't know that to copy it you can just copy the pointer
 
8:52 PM
it doesn't.
but you only copy the pointer, never the thing itself.
 
you tell them to
 
and you never pass or return the thing, you only pass and return a pointer.
 
the signature has to be the same on both sides
 
Ell
What useful things can the compiler do with an opaque value besides the functions provided by the api?
 
Your mom
 
8:53 PM
LPSTR is not opaque
 
Ell
this is too abstract for me, I need to see some code to understand I think
but nevermind
 
nothing, but the compiler never has opaque values.
 
Ell
it ain't worth your time
 
it only ever has opaque pointers.
 
@CatPlusPlus Well,' Pointer to Wide STRing' should have given you a clue?
 
8:53 PM
it's the pointer to null terminated string
 
which are concrete values.
 
@MartinJames It's a shell function so fuck knows
 
Ell
okay so let's say we have this: typedef int* PageSize;
 
@Puppy s/concrete/plasterboard
 
Ell
meh I don't understand still vOv
 
8:56 PM
formulating the confusion in the problem statement would be a good start
it's unclear what you're asking currently
 
@Puppy aligned_storage is kinda opaque
 
Ell
It's unclear to me what exactly needs generating in FFI
 
@CatPlusPlus Windows is pretty consistent with its typedefs.
 
Assumptions are a good way to make bugs
 
@Ell one compiler of language A has to generate code to call the function which is generated from the code in language B by the compiler of language B
 
8:59 PM
@CatPlusPlus Or you could just read the documentation.
 
Ell
@milleniumbug right
 
@EtiennedeMartel if you read it, it wouldn't be an assumption
 
I don't know why you're even saying these things at me
 
presumption?
wtf is the difference there?
 
14 mins ago, by milleniumbug
the contract here is named "calling convention" and there's a list of responsibilities calling side has to do, and the list of responsibilities caller has to do.
 
Ell
9:00 PM
@milleniumbug okay
 
these requirements include pretty much how is information passed, the binary layout of the content passed, what things need to be done before the call and which need to be done after the call, and who does what
 
Ell
Right
I don't see where the need for knowing the underlying type comes in
or rather I don't see how knowing the underlying type helps
 
Because I'm using it
 
@Ell if I call strlen from x86 assembly, I have to push the pointer to the null terminated string to the stack before I do call _strlen
 
I ask for a value, I get a pointer to value, I want the value
 
9:04 PM
It was nunit that was broken, downgrading to 2.6.4 fixed most issues.
 
Ell
@milleniumbug right
 
Kinda interesting that a unit testing framework ships mega broken :)
 
And I need to know what I need to do to get the value which is where the type is needed
 
woah, I never realised just how many tiny little shit hole airports there is around the UK
 
Maybe combo r#/nunit idk
 
9:05 PM
my responsibility is actually providing the valid pointer to the memory, and assuring that there's a null terminator after there
 
If you need concrete examples then this is the function msdn.microsoft.com/en-us/library/windows/desktop/…
I also needed to know the exact type and layout of KNOWNFOLDERID!!!!
 
now comes the relevant part to the discussion I think: if I call the Windows function that takes in LPSTR, then I have to do the same thing
 
GUID structure is weird as fuck
 
:\ good thing about this place I'm thinking of trying to get a job... it's right buy a river, so I could boat to work.
 
if I do a mistake and push a null terminated narrow string to the function that expected a null terminated wide string, the caller gets mojibake
 
Ell
9:08 PM
@CatPlusPlus thanks
meh I must just be a badlet because I don't understand how to produce a REFKNOWNFOLDERID
 
that's why I need to know the specific type
 
It's a pointer to KNOWNFOLDERID which is a typedef for GUID which is a struct (DWORD, WORD, WORD, BYTE[8])
So you need to know that, construct a proper GUID and then get a pointer to it
 
Ell
But shouldn't there be some function which returns a REFKNOWNFOLDERID? else you are looking into implementation details
(obviously I'm not claiming to be correct here)
There must be a reason for them to typedef it besides typing less vOv
 
There seems to be the IKnownFolder interface
 
the official reason was x86 real mode addresing with segmentation (that's why it's Long Pointer to STRing)
 
9:16 PM
@TonyTheLion GetPath of that is SHGetKnownFolderPath
Except you don't have to go through COM dance for the latter
 
yes, avoiding COM dance sounds good
 
@Ell There are named constants, but you need to know the actual value anyway; you can't do FFI without looking at those details
 
inb4 why can't you
 
Ell
I still don't understand but clearly I'm being blind so I'll leave it and come back to it in a while
thank you for the time anyway
 
@Ell It's documentation/type safety thing
But that's not important for FFI which works at ABI level not language level
 
Ell
9:18 PM
@CatPlusPlus but doesn't the type safety come from preventing you from doing things you can do to the underlying type?
@CatPlusPlus yeah I think this is the bit that I'm missing
 
No, that's not what type safety means
 
@Ell That would be an opaque type, I think.
 
@Ell yeah but processor can't see types
 
These typedefs can resolve to different types with the same underlying representation so you can't pass KNOWNFOLDERID or whatever to some other function that takes other kinds of GUIDs
That's type safety
 
languages do
 
9:21 PM
Which is why C APIs should use struct whatever_tag *whatever_handle; for their opaque handles instead of void*
 
Ell
Right
 
Even though that's p much the same thing
 
Ell
I think I understand now
 
highly unlikely
 
WinAPI's been doing that with HANDLE stuff for a while
 
9:22 PM
Took long enough
 
Ell
@набиячлэвэлиь grate cuntrobuttion
 
@Ell oh babby, was your message deep
 
also your Haskell implementation probably can't #include a C header to read the declarations
 
@набиячлэвэлиь you know what else is deep
 
@milleniumbug That's because they're inferior.
 
9:31 PM
@Jefery Your vagina?
 
Just like you did
It just doesn't work sometimes
 
0
Q: Fire all the "community moderators" they all suck

Ronald McDonaldthese site all suck not due to one reason. Overzealous moderators. Just let people ask questions and get answers. Get a LIFE. stop being dipshits and getting excited about closing other peoples questions. Some people just can't handle even the tiniest bit of power.

 
hahalol
 
9:38 PM
@Mysticial I laughed, but this troll is terrible.
 
 
@EtiennedeMartel you have to remove the https so that it becomes http
 
@Feeds wow interactive xkcd
 
@TonyTheLion Sometimes I do that and it doesn't work.
Linking to tweets with pictures is super unreliable
 
@EtiennedeMartel When it doesn't work I just edit and press enter again, sometimes the second time it will post it properly
 
9:42 PM
Nothing is reliable
 
There's a nasty smell of CSIDL_stupidnumber in the Lounge :(
 
Foul smelling creatures
 
@ElimGarak Some pets get fleas, cat gets CSIDL_COMMON_DOCUMENTS. I would prefer the fleas.
 
9:50 PM
And in case anyone missed it:
 
WHY WON'T PEOPLE LET OTHER PEOPLE SOLVE MY STUPID PROBLEMS FOR ME? GOD WHY
 
@Mysticial Thanks - it wasn't around for long.
 
Martin's rep is back, yay.
 
It's weird, heh.
 
@Mysticial 2389
@Mysticial are you ever worried you accidentally click it?
 
9:53 PM
Some newcomer comes on SO, doesn't bother reading the rules, asks a shit question and the question gets closed immediately.
From there there are three possible outcomes:
The newcomer figures it's just too much work and leaves SO without saying anything.
 
@ElimGarak Yeah. After a resume, the privileges sorta leak back a bit at a time. Must be MySQL..
 
The newcomer realizes his mistake, fixes the question, and may or may not become a productive member of the community
The newcomer believes the issue isn't with his question, but with the rules themselves, so he goes on a rampage.
The third option is why Donald Trump is popular.
 
@EtiennedeMartel That has happened?
 
The Dunning–Kruger effect is a cognitive bias wherein relatively unskilled individuals suffer from illusory superiority, mistakenly assessing their ability to be much higher than is accurate. Dunning and Kruger attributed this bias to a metacognitive inability of the unskilled to recognize their own ineptitude and evaluate their own ability accurately. Their research also suggests corollaries: highly skilled individuals may underestimate their relative competence, they may erroneously assume that tasks which are easy for them are also easy for others, and they may incorrectly suppose that their...
 
@MartinJames Rarely, but I think it has
 
9:55 PM
@MartinJames I mean, it has to be.
 
Yeah, just wanted to link it.
 
Not everyone can be an asshole.
 
The problem can't be in me, I'm too smarts.
 
Meh, fuck 'em. I downCloseVote them and I get moaned at for not leaving comments. I leave umm.. 'honest and forthright' comments and I get suspended for a week.
 
Martin from James
 
9:59 PM
@MartinJames #offtothepub
 
good eve @all!
 
@EtiennedeMartel Sounds like a plan.
 
this stackoverflow.com/questions/33902558/… is the icing on today's cake. Wants to provide "an example" for "students" .
 
user1804599
> Wearing a burqa in public in the Swiss canton of Ticino will be an offence punishable by a fine of up to 10,000 francs ($9,813), the cantonal parliament decided on Monday.
 
user1804599
10:07 PM
lol $9,813
 
> Could not complete your request because of a program error
well fuck you, too, photoshop
 
my hand is pinned by my cat
 
user3790646
Good evening.
 
Your hand is your cat
 
@thecoshman so you can't fap?
 
10:17 PM
@thecoshman Better than getting forked.
 
omg
I always wanted to know how to build clocks like ahmed
finally someone made a tutorial
 
I suppose if they're taking out each other: foxnews.com/world/2015/11/24/…
 
"This dying is boring." — last words of Richard Feynman according to his sister.
 
@TonyTheLion she was on my lap
 
10:27 PM
We can all agree that nobody should die alone. Order an improvised explosive device today and enable your loved ones to share the experience. A 20% discount goes to the terminally ill.
 
@orlp BOOOMB!!!
 
user1804599
Ugh, Comedy Central censors South Park again.
 
How is South Park still going?
 
user1804599
It's hilarious and therefore people watch it.
 
it's so tedious now though
 
10:33 PM
Franchise fatigue must be an unknown concept to folks. :/
 
even M&T are tired of making it
 
user1804599
But if they cut out "fuck them all to death" to not *offend* people, it's not funny anymore, and you could just as well not watch.
 
user1804599
or censor a drawing of muhammed
 
user1804599
it's generally funny ;_;
 
heyyyy
 
10:37 PM
ITT people don't understand that people like different stuff
 
ITT Jefery :)
hi
anybody mumble?
 
user1804599
Too busy reading tweets.
 
@TonyTheLion u suk
 
@TonyTheLion nah, heading up now to shiver myself to sleep after a bit of reading
 
@thecoshman I know the feeling, my flat doesn't heat very well and my room is currently cold
I need to go and switch on the heating
 
10:46 PM
@TonyTheLion My room is cold-by-design-choice
 
I like it a little cold, but not butt-freezing-cold
 
well, the heater pumps out the heat fast, but the windows let it out almost as fast :(
 
@thecoshman sadly this
 
oooh, almost forgot to say, passed the driving test there today :D
10
 
practical?
 
10:47 PM
shower me with praise!
@TonyTheLion yeah
 
congrats :) :D :)
 
tah :D
any way, nighty nighty
 
night
 
Lost reference?
lol
 

« first day (1865 days earlier)      last day (3066 days later) »