Replies

This profile is from a federated server and may be incomplete. Browse more on the original instance.

sos, to cpp
@sos@mastodon.gamedev.place avatar

Just looked up how to do callbacks in C++ and YOU CAN'T (unless you write a bunch of templates and wrappers yourself).

When you pass a pointer to non-static member function, yopu need to handle the class pointer yourself. This is like the simplest thing, why can't C++ have that?

Love how the ISO standard website just tells you "Don't". What a joke.

gracicot,
@gracicot@mastodon.social avatar

@sos @morten_skaaning Just not exactly what you expect. Pointer to member (data or function) allows to put a member in a variable, in order to dynamically select a member on a given object. So you can dynamically put a member in a variable auto mptr = &type::member then given an object, access that member, replacing object.member with object.*mptr. It's just a way to deffer or select dynamically members at runtime.

gracicot,
@gracicot@mastodon.social avatar

@sos @morten_skaaning If you want to create a callback just out of a member function and this the STL actually got it for you, no need for templates:

auto callback = std::bind_front(&type::member_function, this);

It's a bit like javascript where you need to bind a class function with an instance to properly use it as callback.

gracicot,
@gracicot@mastodon.social avatar

@sos @morten_skaaning The other answer would be of course "just use a lambda" because they work for pretty much all cases, even for C functions that can get a void*

Patricia, to random
@Patricia@vivaldi.net avatar

I am never going to get the hang of mastodon “DMs”

gracicot,
@gracicot@mastodon.social avatar

@Serene117 @Patricia I had the same reaction

mattgodbolt, to random
@mattgodbolt@hachyderm.io avatar

Happy 12th Birthday to the funny little project that stole my name

gracicot,
@gracicot@mastodon.social avatar

@mattgodbolt your name is a verb too now. I godbolted code my code many times.

mcc, to random
@mcc@mastodon.social avatar

So I spent a big chunk of my life living next door to Louisiana (Houston) and now I live next door to Quebec (Toronto) and it just this moment occurred to me to check if Quebec has beignets. Like, I'd simply assumed if I ever went liking for beignets I'd find them. So I asked a Quebecoise friend, and

Okay, so they do have them, but—

Quebec beignets have holes???

My world is (topologically speaking) rocked

gracicot,
@gracicot@mastodon.social avatar

@mcc potato maple beignets are the best

gracicot, to random
@gracicot@mastodon.social avatar
gracicot,
@gracicot@mastodon.social avatar

I was flabbergasted. I didn't expect it to be so bright and so colorful. Truly a spectacle!

jakub_neruda, to cpp Czech

Funny. I removed all modules from my C++ codebase (roughly 10% of it) and I got about 10-16% shorter compilation times. Not to mention Intellisense no longer crashing all over the place.

I wonder if it ever be a worthwhile feature to use.

gracicot,
@gracicot@mastodon.social avatar

@jakub_neruda the feature is not ready for prime time. Don't use it if the bleeding crashing edge is not your thing.

For compilation speed, it depends how fine grained your modules are. The smaller your modules are, the longer the compile time. They are not meant to replace headers 1:1. A good example is the STL, where any other splitting than just import std was found to be slower.

aks, to cpp
@aks@scalie.zone avatar

Ok folks.

Is using static always evil or is having something like game state (paused, running, in menu etc) inside a static variable ok?

Or do i have to pass it around everywhere?

gracicot,
@gracicot@mastodon.social avatar

@aks usually, you should use a static function scope variable to create a singleton. Then you do your stuff through it.

I usually avoid global mutable variables though, or singleton of any form.

Schlangenmensch, to cpp German

Does anybody know when it will be possible to mix #c++ named and classic with ?

gracicot, (edited )
@gracicot@mastodon.social avatar

@Schlangenmensch from what I understood, you can include then import, but not the other way around. Minus bugs of course

vitaut, to random
@vitaut@mastodon.social avatar

Wait, what? {fmt} and vulkan-hpp are the only two modularized projects? https://arewemodulesyet.org/

gracicot,
@gracicot@mastodon.social avatar

@vitaut no libraries got the clown emoji award yet?? Disappointed

gracicot, to random
@gracicot@mastodon.social avatar

It's happening soon. There's not a cloud in sight!

gracicot,
@gracicot@mastodon.social avatar

Towards totality

gracicot,
@gracicot@mastodon.social avatar

I'm still shaking. It was just like seeing a new color for the first time. It's impossible to explain how this felt. I'm truly grateful for this experience.

Total solar eclipse

vitaut, to random
@vitaut@mastodon.social avatar

Module support in MSVC is a garbage fire https://github.com/fmtlib/fmt/issues/3921

gracicot,
@gracicot@mastodon.social avatar

@vitaut MSVC support is excellent, as long as you're only doing hello world, just like how they test before calling a feature "ready"

olafurw, to random
@olafurw@mastodon.social avatar

A formal specification for a C++ package and dependency manager has been published. This will be very interesting for the language going forwards.

See: https://isocpp.org/ for more info.

gracicot,
@gracicot@mastodon.social avatar

@olafurw why 😭

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag3
  • Durango
  • mdbf
  • osvaldo12
  • magazineikmin
  • tacticalgear
  • rosin
  • thenastyranch
  • Youngstown
  • InstantRegret
  • slotface
  • everett
  • kavyap
  • DreamBathrooms
  • JUstTest
  • khanakhh
  • ethstaker
  • cubers
  • tester
  • modclub
  • ngwrru68w68
  • GTA5RPClips
  • cisconetworking
  • megavids
  • anitta
  • normalnudes
  • Leos
  • lostlight
  • All magazines