« first day (1618 days earlier)      last day (3320 days later) » 

user1804599
 
I got a round of applause at the pub quiz tonight.
 
user1804599
But thread-safe.
 
Bastard teammates bailed out so I played alone.
 
user1804599
/me hopes the address of the first base object is well-defined and offset 0
 
user1804599
Actually, I have a better idea.
 
user1804599
10:09 PM
Just a virtual dtor.
 
user1804599
and C++ ABI for JIT
 
Bartek never said where to submit
 
Put it in a public repository somewhere.
 
how'd the game jam go
 
I made tortillas
 
10:14 PM
@райтфолд It isn't.
 
user1804599
Is Itanium C++ ABI used by clang and GCC on OS X?
 
yes.
Itanium or a very close relative is used basically everywhere that isn't Windows.
 
user1804599
Hmm.
 
user1804599
Maybe I can generate the vtable at runtime.
 
that's what I do
 
user1804599
10:17 PM
Then I can just rely on normal C++ dtor behavior.
 
user1804599
And I don't have an extra pointer in each object.
 
My god why is my internet connection so slow?
 
user1804599
Amazing!
 
user1804599
@Puppy Do you implement it yourself or do you use some library that does it?
 
I implement it myself.
 
user1804599
10:20 PM
On a scale from Haskell's sort function implementation to std::deque, how reusable is it?
 
@Cinch Is slow like 56k modem? If not, you have nothing to complain about. :)
 
if you're looking to generate a vtable for a C++ type that is expressed as a Clang type
you can probably make Wide generate a vtable for it and set the vtable pointers appropriately for you
 
user1804599
Oh. :(
 
IEEE 754 decimal so complicated
 
user1804599
I'd rather not have clang as a dependency so I'll look for another library or for the ABI documentation.
 
10:24 PM
Spaking of Marmalade...I loved Marmalade Boy anime.
 
you can rip the Wide implementation
 
implementation of what
 
but it's expressed fairly heavily in terms of Clang, if you wanted to write your own to generate a C++ vtable you'd need quite a few C++ description types
er, wait a minute.
are you trying to make C or C++ calls across the boundaries?
because doing that without Clang's support is fairly suicidal.
 
@BartekBanachewicz @CatPlusPlus github.com/VermillionAzure/letter-frenzy
My sad submission awaits.
 
LLVM does not support the C ABI, you have to use Clang to generate the correct LLVM IR code.
 
user1804599
10:26 PM
The only thing I currently need is to set the destructor of the runtime-synthesised base class.
 
unless you want to re-implement lowering the C ABI to LLVM IR.
 
user1804599
The JITted code won't call that directly.
 
user1804599
It will go through the refcount dropping function, which is written in C++.
 
right, but I hope you didn't intend to pass any arguments to it.
 
user1804599
Only the object.
 
10:27 PM
because those arguments need to be lowered to platform-and-ABI-specific LLVM IR.
including the object.
 
user1804599
But you can emit calls from LLVM IR just fine.
 
@райтфолд But those calls aren't correct.
 
user1804599
Bullshit.
 
user1804599
It's just a free function extern "C" void mill_release(Value*);.
 
user1804599
You can definitely generate a call to that with LLVM.
 
10:28 PM
yes, you can, but you need ABI-specific LLVM IR that lowers to the correct ABI.
you can't just convert it to declare mill_release(i8*).
6
Q: C ABI with LLVM

PuppyI've got a compiler written with LLVM and I'm looking to up my ABI compliance. For example, I've found it hard to actually find specification documents for C ABI on Windows x86 or Linux. And the ones I have found explain it in terms of RAX/EAX/etc, rather than IR terms that I can use. So far, I ...

 
user1804599
@Puppy Eh.
 
user1804599
It's just cdecl.
 
which is NOT SUPPORTED by LLVM.
you have to support it.
well, it's kinda half-supported but you still have to do a lot of legwork.
 
user1804599
Or well, the C calling convention of the platform.
 
user1804599
10:30 PM
I've done this before with LLVM and it worked just fine.
 
user1804599
If LLVM didn't support calling C functions then practically nobody would be using LLVM except clang.
 
user1804599
It's even in the Kaleidoscope tutorial.
 
which is a pretty bad tutorial.
@райтфолд Other compilers like LDC do their own C ABI lowering.
@райтфолд Those calling conventions assume generated IR that matches the calling convention.
 
user1804599
How does ExecutionEngine's automatic symbol finding work, then?
 
user1804599
Can you not call functions found by it?
 
10:33 PM
symbol lookup doesn't care about ABIs.
 
user1804599
What use would it have?
 
it's useful for finding functions.
calling them correctly is your problem.
 
Doesn't Clang like export some classes/functions that would allow non-C front-ends to generate calls to C functions without full knowledge of the target ABI or copy/pasting the code?
 
trust me, ask on the LLVM IRC channel and you will learn as I did that LLVM does not handle this for you.
 
@LightnessRacesinOrbit halp me
I wanna say something like "His fear might indeed be true", but is "true" really the right word to use?
 
10:35 PM
Accurate? Realised?
 
@Blob Justified?
 
the fear is a certain set of circumstances. i wanna say the set of circumstances might actually be the case
does "justified" work for that?
 
Then 'justified' yeah.
 
what if he has no evidence at all
there's nothing to justify with
 
Yeah, it’s more of a phrase than anything.
 
10:37 PM
@wilx No, no it does not.
people have been complaining for some time about this but nobody in Clang development cares about such matters.
 
you know what’s coming next…
 
@Blob "Justified" doesn't require that he have evidence--it just means that what he fears may actually be true.
 
Pull requests welcome!
 
I did actually try, but they're not interested relaly
 
user1804599
> <d0k> eli-se: ccc is what you want
 
10:45 PM
but did he tell you that it covers every aspect of the C ABI for every platform?
 
user1804599
No, only that.
 
3
Q: Convert float to string with set precision & number of decimal digits?

ShannonHow do you convert a float to a string in C++ while specifying the precision & number of decimal digits? For example: 3.14159265359 -> "3.14"

Stringstreams are shit.
 
user1804599
Also, yes, that's my IRC name. If I went under the name rightfold people would go all like "omg are you the real rightfold?" "holy shit I can't believe I'm talking to the real rightfold!" "woot I know you man you're that awesome guy!"
 
user1804599
<d0k> eli-se: LLVM's support is just incomplete. it will break if you throw complex stuff at it (like structs)
<d0k> eli-se: simple integers/pointers/floats should be fine
 
user1804599
@Puppy He said this, so I should be fine since this is all I want anyway.
 
10:48 PM
@райтфолд What IRC-channel are we talking about
 
user1804599
#llvm
 
@райтфолд Fair enough, that should be sufficient for you then.
 
user1804599
fuckin awesome mate
 
user1804599
So, let's look at C++ ABI.
 
user1804599
Probably a hundred page document.
 
10:51 PM
@Blob have some grounds, be reasonable
 
@райтфолд No, it's actually fairly simple, especially if you're only dealing with a limited case.
what is the virtual interface of this base class, anyway? just virtual destructor?
 
user1804599
Nice.
 
@Blob appropriate?
 
user1804599
class Value {
public:
    virtual ~Value() = 0;

private:
    std::size_t refcount;

    friend void mill_retain(void*);
    friend void mill_release(void*);
};
 
user1804599
That's the base class. I want to add fields and dtor dynamically.
 
10:53 PM
something calls for the name mill_stone
 
user1804599
kidney_stone
 
@райтфолд Yeah, if you have a class which has only Value as it's base, then all you need is the primary-base case.
 
thirty_stone // US edition
 
which basically means that the vtable is 1 offset-to-top and 1 function pointer thunk.
and 1 entry for RTTI if you want to support that.
and just don't forget to offset the vptr.
 
user1804599
Boost y u no this.
 
10:55 PM
u boost no what
 
oh
 
user1804599
@sehe Tell me.
 
but it might be easier to simply accept a function-pointer-thunk in the constructor.
then you'd have no virtual components, and the code would be much simpler and easier to handle.
and it wouldn't even be fatter because vptr vs function pointer - same size.
 
@райтфолд are you looking for helpers to "portably" go from a member to containing struct? Because, Boost Intrusive has this going on (and it's semi-exposed for implementing custom value traits)
 
near as I can tell, he doesn't actually need it
@райтфолд Wait, you want to add fields dynamically?
 
10:59 PM
I agree
 
user1804599
@Puppy When creating the subclass.
 
user1804599
The subclass can have fields other than refcount.
 
ah
I was just thinking that.
 
user1804599
I don't intend on growing them after they have been created.
 
but you don't really need a lot of the C++ virtual machinery in this case.
 
11:10 PM
Except, downvoting a poor question doesn't victimize the OP. Frankly it's not constructive to think about question validity in emotional terms. This question is misguided and shall not likely be useful to anyone else in the future. Therefore it merits a mild downvoting. Perhaps it could be completely rewritten into something more viable ("What does binary output really mean"). Kudos for you for helping the guy out. +0 from me — sehe 34 secs ago
 
Wow. I didn't realize that using #Boost #Intrusive would under the hood pull nasty ABI-specific tricks like that o.O http://www.boost.org/doc/libs/1_57_0/boost/intrusive/detail/parent_from_member.hpp
 
user1804599
cool
 
> "Tail of Puppy"
 
user1804599
 
11:12 PM
@райтфолд I mentioned it 14m ago :)
 
user1804599
I didn't.
 
> Stranglekelp
@райтфолд fail :)
 
@sehe bartek suggested it
 
I think "Piss of Cat" must be a typo. Perhaps that's where Jefffrey got the redundant f from
 
user image
4
 
11:15 PM
Very good.
I believe the technical term is 'false start'
 
lol
 
user1804599
@Puppy I'm confused!
 
user1804599
 
user1804599
No idea why the same entry has to be there twice though.
 
user1804599
If I omit one of the two I get a segfault.
 
11:17 PM
@sehe why don't you explain what does binary output really mean? it may be helpful to me. Depending on the answer I may rewrite the question. — user3787097 4 mins ago
entitled much
 
user1804599
Is it the base dtor and the derived dtor?
 
user1804599
No, then it would be called twice.
 
virtual ~Value() = 0;
Value::~Value() = default; // ???
 
user1804599
> The entries for virtual destructors are actually pairs of entries. The first destructor, called the complete object destructor, performs the destruction without calling delete() on the object. The second destructor, called the deleting destructor, calls delete() after destroying the object. Both destroy any virtual bases; a separate, non-virtual function, called the base object destructor, performs destruction of the object but not its virtual base subobjects, and does not call delete().
 
user1804599
Ah, I see.
 
user1804599
11:21 PM
@melak47 Pure virtual destructors need an implementation.
 
Haha. I never complained. FTR I was conversing with HostileFork because he was raising a meta-issue in his comment. I made it amply clear I did /not/ downvote this post, but explained why it would not be victimizing you. (And you go and berate me for not "sharing my perls of wisdom"? Well, I'll tell you what. Smells like awesomely entitled to me, yes.) — sehe 5 secs ago
Poor dude. Now he earned my downvote after all ^|
 
user1804599
typeid doesn't like my mother :( coliru.stacked-crooked.com/a/e6ea838549029857
 
@user3787097 If you're going to be this rude to people who spend every single day helping people on this site, perhaps you should reconsider your attitude. A bit. — sehe 31 secs ago
Dammit. I fell for it.
 
Do you guys know any decimal types for C++?
 
user1804599
@Rapptz No.
 
11:30 PM
Outside of GMP or Boost.Multiprecision
 
Agh
std::to_string bug in MinGW
 
@Rapptz cpp_dec_float?
@Rapptz ahaha lel. You didn't seriously o.O
@Nooble more info?
 
I can't use either.
 
foot-in-mouth
 
sucks
 
11:33 PM
@sehe It results in a to_string not a member of std error.
 
That's not a bug right. That's just a missing feature
 
^ awesome
Zing. That's a nice nugget to ace an answer with. +1 — sehe Oct 19 '12 at 13:56
 
user1804599
Is it possible to call a base dtor explicitly?
 
Seems I thought the same before ^
 
11:34 PM
@Rapptz Thanks.
 
@райтфолд you mean, without UB?
 
@Nooble You should use MinGW-w64 in 2015.
 
user1804599
Ah, ->Value::~Value();.
 
user1804599
Looks almost like Perl.
 
They fixed this a long time ago
 
user1804599
 
user1804599
I guess I also need to set the vptr before calling the super dtor.
 
@Rapptz They forgot to send automatic updates to Nooble's machine though :S
 
@Rapptz I was under the impression that I did download the latest version.
 
ITT pantoona is ThePhding pretty hard
2
 
I just got MinGW a few days ago :P.
 
11:36 PM
Have you seen a physician?
 
@sehe How dare they.
@sehe Yes, which is partly why I missed the Marmalade.
 
:D
 
@Nooble What did you download?
 
yeah that's not mingw-w64
that's mingw
 
11:39 PM
I suck.
 
it's confusing dw
 
user1804599
@sehe You can say whatever you like, except that. You're going too far.
 
:D
 
I link MinGW-w64 distros in the answer above
 
Wonderful.
I'm download the Nuwen one.
 
user1804599
11:42 PM
This music is amazing: youtube.com/watch?v=QeqLNGAVqK4
 
user1804599
The boss battle it comes from is incredibly difficult, though.
 
The nuwen distro has more stuff in it but it doesn't support std::thread and friends.
 
Woah what.
 
The MinGW-Build distro has less stuff but supports std::thread.
 
I'll get that one then.
 
user1804599
Alright, I can look at clang's output for this: coliru.stacked-crooked.com/a/9b722848c8ba8e5c
 
@Rapptz Thanks.
 
I'll go make my own decimal type. With hookers and stuff.
2
 
user1804599
@Rapptz You can look at Mono's implementation.
 
user1804599
And just translate it to C++.
 
11:47 PM
@райтфолд lol -W{all,extra}
 
Protip: don't rename your LVM lvs without updating the kernel args and fstab.
 
@melak47 It’s pure virtual. With an implementation that does the same thing as the default would do (if it weren’t for the pure virtual declaration).
 
@райтфолд Alright.
 

« first day (1618 days earlier)      last day (3320 days later) »