Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Cybernetic Vermin
Apr 18, 2005

one wonders what hackbunny actually does. i picture some standard banal coding task, from which he keeps getting distrated going "oooh, where does *this* pointer go?!"

Adbot
ADBOT LOVES YOU

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

rjmccall posted:

their member function pointer representation is so much more complicated than you're giving it credit for

well they try their hardest to always return a flat function pointer, if at all possible #justclthings

rjmccall posted:

i didn't know that they'd changed it to not thunk virtual functions, though

caught me, I didn't check actually, but I assume they do now that they've switched to a single layout for all cases of member function pointer

rjmccall posted:

also not sure what you think the problem is with that

I want the goddamn method implementation pointer is my problem with that. I know it's completely non portable but you'd think there was a compiler-specific way to do it. but no, no way to get the implementation pointer, or a pointer to the vtable, or a vtable slot index. none at all. void **pvtbl; memcpy(&pvtbl, object, sizeof(pvtbl); like a animal

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
those aren't the semantics of member function pointers. they have to dispatch. the implementation pointer can only even theoretically be recovered when the object is known, which it isn't

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

hackbunny posted:

well they try their hardest to always return a flat function pointer, if at all possible #justclthings


caught me, I didn't check actually, but I assume they do now that they've switched to a single layout for all cases of member function pointer

that almost certainly has nothing to do with virtual functions and everything to do with all the other representational complexity due to virtual/multiple inheritance, which msvc has historically been non-compliant about

if they've picked a single representation it's probably the four-pointer form, tho maybe they decided to bail on virtual-base conversions since they ended up not actually being legal under the standard

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

rjmccall posted:

those aren't the semantics of member function pointers. they have to dispatch. the implementation pointer can only even theoretically be recovered when the object is known, which it isn't

but I have the object! (where would I memcpy the vtable pointer from otherwise?) borland c++ had a proprietary operator to take a bound member function pointer, but visual c++ doesn't. still now I wonder what the borland operator actually returned

member function pointers give me a big headache and I don't have a mental model of them

Cybernetic Vermin posted:

one wonders what hackbunny actually does. i picture some standard banal coding task, from which he keeps getting distrated going "oooh, where does *this* pointer go?!"

lol you aren't even wrong. but right now I'm doing re so I need to gently caress with abis and the like

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

hackbunny posted:

but I have the object! (where would I memcpy the vtable pointer from otherwise?) borland c++ had a proprietary operator to take a bound member function pointer, but visual c++ doesn't. still now I wonder what the borland operator actually returned

member function pointers give me a big headache and I don't have a mental model of them

sure, you can have a non-standard operator or something. some compilers used to let you partially apply a member function (e.g. obj.foo) and get the implementation back as a function pointer, although that was a quirk of their implementations, usually did not work correctly with multiple inheritance, and has mostly been stamped out (but you might still be able to use some flag to re-enable it, idk)

a member pointer is an abstract reference to the member. you take it and an object and can get a concrete reference to a specific member. for a member function, all you can do with that is call it, which you have to do immediately, just like a direct access to the member. but it's specified to have the same behavior as what a direct access would have done

Bulgogi Hoagie
Jun 1, 2012

We
my c++ education going well, covered pointers and references, can use smart words like stack and heap now, also memory leaks for everyone

Bloody
Mar 3, 2013

std::make_shared

Bloody
Mar 3, 2013

that's basically all the c++ I learned

Bloody
Mar 3, 2013

that's basically all the c++ I learned

Bloody
Mar 3, 2013

cool doublepost didn't know that was even possible

hobbesmaster
Jan 28, 2008

Bloody posted:

std::make_shared
thats communism


https://twitter.com/isotrumpp/status/704382042327420930

Shaggar
Apr 26, 2006

Bloody posted:

I don't know what a mapper does

mybatis is a statement mapper. it maps a method in your code like

C# code:
Boner GetBoner(int bonerId)
to a sql statement like

SQL code:
GetBoner_sel_sp(@BonerId)
it handles mapping of input and output for you either thru reflection or code generation. theres also mybatis-spring which lets you specify an interface and a mapping file and it will generate a proxy bean that automaps the sql statements to the interface methods. its really really good.

dapper is not as good as mybatis, but it gives you some simplified stuff like being able to call a proc and have the input/output mapped for you from your existing type like

C# code:
public async Task<Butt> GetButt(Boner boner)
{
	using(SqlConnection conn = _GetConnection())
	{
		return await conn.FirstOrDefaultAsync<Butt>("GetButt_sel_sp",boner,CommandType.StoredProcedure);
	}
}
that's not exactly the syntax but is similar.

Bloody
Mar 3, 2013

so it's like most of the good parts of an orm without all the orminess

Xarn
Jun 26, 2015

Bloody posted:

std::make_shared

no, make_unique!

Soricidus
Oct 21, 2010
freedom-hating statist shill

Bloody posted:

that's basically all the c++ I learned

not continuing to learn c++ was the best decision you'll ever make

this is probably true even if your job involves writing it

Shaggar
Apr 26, 2006

Pollyzoid posted:

some stuff about the insides of windows subsystem for linux https://www.youtube.com/watch?v=_p3RtkwstNk

this is cool.

Fergus Mac Roich
Nov 5, 2008

Soiled Meat
Is there some way to make C++ do late binding

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
true late binding — string-based lookup with dynamic type matching and so on — doesn't really play well with a lot of different c++ features. that's not really the direction c++ wants you to take, and my first instinct is to tell you to find a better approach that fits more idiomatically with the tools c++ does give you

but if you really wanted to, you could certainly come up with something tolerable using templates and macros (tolerable to use, at least; other people would probably be terrified of touching it)

Bulgogi Hoagie
Jun 1, 2012

We
OOP looks like dog poo poo garbage in C++

seiken
Feb 7, 2005

hah ha ha
OOP is dog poo poo garbage.

gonadic io
Feb 16, 2011

>>=

Bulgogi Hoagie posted:

OOP looks like dog poo poo garbage in C++

you'll be happy to note that Rust has made interop with c++ including c++ oop code a priority for this coming year

https://github.com/aturon/rfcs/blob/roadmap-2017/text/0000-roadmap-2017.md posted:

The goal should be that using a C++ library in Rust is not much harder than using it in C++. In other words, it should be possible to directly include C++ headers (e.g., include! {myproject.hpp}) and have the extern declarations, glue code, and so forth get generated automatically. This means (eventually) full support for interfacing with C++ code that uses features like templates, overloading, classes and virtual calls, and so forth.

Workaday Wizard
Oct 23, 2009

by Pragmatica

gonadic io posted:

you'll be happy to note that Rust has made interop with c++ including c++ oop code a priority for this coming year

i want this now :captainpop:

Xarn
Jun 26, 2015
Is that in general, or just for specific ABI? Because if its the former, wow.

Sapozhnik
Jan 2, 2005

Nap Ghost
rust-spec.md: #include "c++-spec.nightmares"

i'm sure this will turn out just fine

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.
why not just rename it c++/-- at this point?

Workaday Wizard
Oct 23, 2009

by Pragmatica

Sapozhnik posted:

rust-spec.md: #include "c++-spec.nightmares"

i'm sure this will turn out just fine

i'm hoping they can delegate the real parsing work to gcc or clang

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

gonadic io posted:

you'll be happy to note that Rust has made interop with c++ including c++ oop code a priority for this coming year

well, i guess it had a pretty good run sounding like an interesting language. rip.

Cybernetic Vermin
Apr 18, 2005

if i had to do this i would legit just swallow clang, and invoke it runtime to build incredibly stupid glue, rather than attempt to make any sense of what happens in c++ interfacing from the outside

i expect that is too heavy-handed to fly in that kind of project though

Brain Candy
May 18, 2006

Wheany posted:

well, i guess it had a pretty good run sounding like an interesting language. rip.

worse is better. this is good news, rust just might live

Volte
Oct 4, 2004

woosh woosh
what's the point of living if c++ flows through your veins

return0
Apr 11, 2007

Shaggar posted:

one of c#'s greatest strengths is not running on linux.

soon windows will run on linux

Bloody
Mar 3, 2013

no but linux does already run on windows

return0
Apr 11, 2007
winux

Shaggar
Apr 26, 2006

Bloody posted:

no but linux does already run on windows

the linux subsystem is not linux, but a true emulation/translation layer for linux system calls.

VikingofRock
Aug 24, 2008




leper khan posted:

why not just rename it c++/-- at this point?

Bloody
Mar 3, 2013

c diff

Soricidus
Oct 21, 2010
freedom-hating statist shill

Sapozhnik
Jan 2, 2005

Nap Ghost

:drat:

Adbot
ADBOT LOVES YOU

JewKiller 3000
Nov 28, 2006

by Lowtax

:captainpop:

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply