When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
29 messages ยท Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
@astral pivot
quoting myself from the text channel:
constexpr is used to declare variables whose value is known at compilation, or functions whose calls can be evaluated entirely during compilation
basically it allows you to spare runtime costs by hardcoding things without actually hardcoding them, kinda
it's powerful but it comes with constraints, not everything can be a compile-time constant
where/why do you need to use it?
it caught my eye in a video of AngeTheGreat
yeah
you can think of constexpr as const on steroids
it's not accurate and doesn't paint the whole picture but if you need to ask it's good enough that you think of it in these terms
so like const float pi = 3.14f can be written as constexpr float pi = 3.14f (roughly)
yes, because 3.14f is a value known at compile-time it can be assigned to a constexpr value
this gud sht
a bit pedantic, but constexpr isn't about compile time vs runtime, it's about constant expressions, which is how the standard specifies it
sure, though compile-time vs runtime is mostly how it manifests and I thought this would be a good approximation to make sense of
thanks for bringing that in though ๐
well, I am mentally unhinged enough not to understand the mechanics of this language, but good way to torture myself with exams up head
don't worry, everyone in this server went through that ๐
at the calmest level
@blissful pilot do you want to have a look at the code you posted in the text channel? there's room to improve it
if you don't want or prefer to figure it out yourself it's fine too
don't hesitate to ask more questions if needed
(yes I'm at work and bored out of my f*cking mind)
i have to prepare for exams(not ordianary exmas you have 2years to prepare, if you fail, gotta wait another year ), and i'm here making a goddamned terminal game
@blissful pilot
Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.
!solved