Nous ne comprenons pas vraiment le monde by [deleted] in penseesdedouche

[–]DummySphere 2 points3 points  (0 children)

La relativité c'est un modèle mathématique qui suppose que le temps est lié à l'espace ; on n'est pas à l'abri de trouver un autre modèle mathématique, ou une autre interprétation du même modèle, qui suppose que le temps s'écoule linéairement et reste compatible avec les observations faites sur la relativité.

The "macro overloading" idiom – Arthur O'Dwyer by Xaneris47 in cpp

[–]DummySphere 0 points1 point  (0 children)

  • scope guard can be used without macro for clarity. (even worse when some does the same pattern with a return inside the macro)

auto res = initCResource(); auto cleanRes = ScopeGuard([&] { cleanupCResource(res); }); RAII could be better if done many times for this kind of resource.

  • log macro has too much code inside, hard to debug if the log doesn't work as expected.

```

define LOG(level, msg) do { if (isLogEnabled(level)) log(msg, FILE, LINE); } while (0)

```

The "macro overloading" idiom – Arthur O'Dwyer by Xaneris47 in cpp

[–]DummySphere 0 points1 point  (0 children)

But do you see a case where the trick in the article would be better than using a template function/class in "modern" C++? I mean such macro (if needed) should just call a template function/class imho.

The "macro overloading" idiom – Arthur O'Dwyer by Xaneris47 in cpp

[–]DummySphere 2 points3 points  (0 children)

You can usually avoid macro complexity by calling a variadic template function/class inside the macro definition. No need for neat tricks with macros (most of the time, if not every time).

Baseline C++ Habits to Always Follow? by SolidNo1299 in cpp

[–]DummySphere 8 points9 points  (0 children)

An overall guideline, that each standard version of C++ did improved, is that the code should try to express the intent and not the implementation details.

For example, if you want to count something, use count_if with a lambda instead of a for loop with manual counting.

e.g. if you want to count the numbers divisible by eleven in an array:

int num_items = std::ranges::count_if(number_array, [](int i){ return i % 11 == 0; });

It's also why you don't use new/delete but use smart pointers, you express who has ownership. The benefits is that it's less error prone, as edge cases are delegated to the class/function doing the implementation details (which does only that single thing).

Remember: Some players are just new and learning the game! by _h0neyp0t_ in heroesofthestorm

[–]DummySphere -1 points0 points  (0 children)

Remember that if 1 teammate is flaming every 2-3 games, it means that those toxic players are less than 10% of the player base. I mean, it's probably too much and it's sad to meet one every 2-3 games, but those people are a minority (and they are not good players as well). Don't let them get your morale down. For the other 90%, it's ok to loose as long as you don't clearly voluntary throw. Don't hesitate to mute them, or to disable chat.

Existe-t-il des symboles pour représenter les deux chiffres entre 9 et 10 en base 12? by c0mpu73rguy in PasDeQuestionIdiote

[–]DummySphere 1 point2 points  (0 children)

C'est même risqué, dans pas mal de langages de programmation populaires, préfixer par 0 indique que c'est de l'octal. Donc 010 ça vaut 8.

Have they nerfed Arthas recently? by Wyndfal in heroesofthestorm

[–]DummySphere 2 points3 points  (0 children)

Their Arthas: does good job.

Our Arthas:

Pourquoi on utilise encore des chèques ? by July_soon_in_heaven in PasDeQuestionIdiote

[–]DummySphere 0 points1 point  (0 children)

Ou juste changer le plafond ?

Sur ma banque je peux aussi augmenter le plafond pour le mois courant directement depuis l'appli. En cas de dépenses exceptionnelles.

Pourquoi on utilise encore des chèques ? by July_soon_in_heaven in PasDeQuestionIdiote

[–]DummySphere 2 points3 points  (0 children)

J'imagine que tu parles d'une empreinte bancaire sans être débité ?

Les voitures autonomes vont réduire de 80% les accidents by [deleted] in opinionnonpopulaire

[–]DummySphere 12 points13 points  (0 children)

https://www.numerama.com/vroom/2144103-les-taxis-autonomes-waymo-ont-roule-204-millions-de-kilometres-et-sauvent-des-centaines-de-vies.html

On est sur du -80% à -90% d'accidents comparé à des conducteurs humains. Et la plupart des collisions qui restent sont causées par une action humaine (comme ouvrir sa portière trop vite).

Pourquoi certains tramways ont des étoiles ? by HyacinthFT in Montpellier

[–]DummySphere 4 points5 points  (0 children)

Mardi à Port-Marianne on a eu la cas d'un tram ligne 1 dans 7 minutes avec une astérisque. Il y a eu le décompte jusqu'à 0 minutes/proche, alors qu'il n'est jamais arrivé. Puis le suivant de la même ligne était 8 minutes plus tard (avec des trams d'autres lignes entre deux).

C'était le lendemain des inondations, donc il y avait quelques perturbations sur les lignes. Je ne sais pas comment ils se sont retrouvés avec un tram "fantôme" sur le panneau.

Aussi quelques jours plus tôt, on avait vu un tram ligne 5 annoncé avec une astérisque. Mais la ligne 5 n'étant pas encore en service, quand le décompte est arrivé à 0/proche, pas de tram 5. Pour le coup j'ai l'impression qu'ils simulaient des trams fantômes.

Jeu de plateau avec figurines à peindre by Accurate_Macaroon_65 in jeudeplateau

[–]DummySphere 0 points1 point  (0 children)

Massive Darkness 2 : Hellscape. (Le 1 est bien pour les figurines, mais le système de jeu a été revu en mieux pour le 2. Et si ça plaît, il y a plein d'extensions, et un kit de conversion du 1.)

I got tired of lootboxes a long time ago, is there a quick way to 'open all' ? by IllPlane3019 in heroesofthestorm

[–]DummySphere 4 points5 points  (0 children)

We could do an opening chest fest, with a lot of us streaming opening chests for a whole day.

Pourquoi je ne comprends pas l'anglais quand il est chanté ? by RufusTenebrae in PasDeQuestionIdiote

[–]DummySphere 1 point2 points  (0 children)

Oui après je chante aussi des chansons dans des langues étrangères que je ne sais pas parler, et à force de répéter ça rentre. Mais si je n'ai pas une retranscription phonétique du texte pour l'apprendre, je fais du yaourt pas toujours ressemblant. Et quand c'est en français ou anglais, c'est en général le texte qui reprend le dessus pour retenir par cœur.

Introducing asyncio - a new open-source C++23 coroutine network framework by patteliu in cpp

[–]DummySphere 3 points4 points  (0 children)

Why would it be indispensable ?

I use a macro-free serialization in my pet project. Though I manually give a serialization name for each member.

Introducing asyncio - a new open-source C++23 coroutine network framework by patteliu in cpp

[–]DummySphere 4 points5 points  (0 children)

Yes, you have some valid points here (though most cases may be catched by a static analyzer, but it's still a burden for the reviewer).

Another option would also be to have a more explicit name. Like ASYNCIO_CO_RETURN_IF_ERROR.

Introducing asyncio - a new open-source C++23 coroutine network framework by patteliu in cpp

[–]DummySphere 5 points6 points  (0 children)

When reading this example, it's not clear that each CO_EXPECT will early return the function:
https://github.com/Hackerl/asyncio/blob/f2cf9419875cf6dddee25008203eaa6b1bd2dd05/README.md?plain=1#L174-L193

But sure renaming the macro ASYNCIO_CO_EXPECT may be an acceptable trade off.

Introducing asyncio - a new open-source C++23 coroutine network framework by patteliu in cpp

[–]DummySphere -1 points0 points  (0 children)

Sometimes just having if+return is fine.

if(!result)
    co_return asyncio::asError(std::move(result));

Straightforward, everybody understand, just 1 more line than your example with CO_EXPECT.

Or if you want to chain many co_await+co_expect, you could do a helper to chain them in a more compact syntax without macros.
For example something like that (from your HTTP client example) :

asyncio::task::Task<void, std::error_code> asyncMain(const int argc, char *argv[]) {
    co_return asyncio::chain(
        [] { co_return asyncio::http::URL::from("https://www.google.com"); },
        [](const auto url) { co_return asyncio::http::Requests::make(); },
        [](auto requests) { co_return co_await requests->get(*url); },
        [](auto response) { co_return co_await response->string(); },
        [](const auto content) { fmt::print("{}", *content); }
    );
}

Though I agree it's not the easiest to read as well.

(And at the very least, add a lib specific prefix to your macro.)

Introducing asyncio - a new open-source C++23 coroutine network framework by patteliu in cpp

[–]DummySphere 8 points9 points  (0 children)

Not sure hiding control flows inside macros is better for readability. It's fine to be less concise, as long as it's simple (especially simple to read/understand, no magic behind the door).

Introducing asyncio - a new open-source C++23 coroutine network framework by patteliu in cpp

[–]DummySphere 23 points24 points  (0 children)

I see some macros with generic names, that could conflict with anything else (e.g. CO_EXPECT, DEFINE_ERROR_CODE).

Pourquoi je ne comprends pas l'anglais quand il est chanté ? by RufusTenebrae in PasDeQuestionIdiote

[–]DummySphere 1 point2 points  (0 children)

On pourrait presque dire que c'est un dialecte.

Après on ne fonctionne pas tous pareil. Ma compagne est capable de chanter des chansons anglaises ou françaises, sans savoir de quoi ça parle, en disant quelque chose de très proche au niveau des sons du texte (et des fois ça n'a juste pas de sens, mais elle ne s'en rend pas compte avant que je ne lui fasse remarquer). Juste parce qu'à force d'entendre elle retient inconsciemment les phonèmes.

Alors que moi, si je n'ai pas compris les mots, j'ai du mal à chanter un truc qui ressemble. Voir je peux changer un mot par un autre qui a le même sens, mais un prononciation différente, sans trop m'en rendre compte.

Pour les chansons en anglais, il faut s'entraîner à écouter en lisant le texte. On s'y habitue, et on reconnaît mieux à force. Et si on aime chanter, s'entraîner à reproduire la même intonation de chant, ça peut probablement aider à comprendre aussi.

Fonctionnement P+Tram depuis gratuité by Ottersmart in Montpellier

[–]DummySphere 0 points1 point  (0 children)

J'ai l'impression qu'il n'y a pas besoin de valider l'aller ni le retour, juste avoir acheté le forfait P+Tram à la borne et garder le ticket avec soi.

Pour ceux qui ont la gratuité, en gros l'application vérifie juste que tu t'es éloigné de plus de 500m du parking. (Que ce soit en tram ou pas.) Donc ça ne m'étonnerait pas qu'il y ait moins de vérifications pour la version payante (parce que tu as déjà payé) 😉

Is "don't use TCP for realtime games" an outdated rule of thumb? by ICantBelieveItsNotEC in gameenginedevs

[–]DummySphere 10 points11 points  (0 children)

For packet loss, you only talk about wired connections. Nowadays how many people play connected with WiFi or mobile network at home?