Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
When the array is initialized at compile time I suppose.
Maybe runtime allocation is better? -
It has very precise meanings though
dynamic typing -> type information checked at runtime
dynamic allocation -> allocation size/existence determined at runtime
dynamic routing -> routing paths determined at runtime
dynamic dispatch -> method dispatch at runtime
(Basically dynamic -> at runtime)
dynamic programming -> yeaaaah this is poor naming, means constructing solutions out of solved sub-solutions.
(For your array, it's not the stack/heap that makes the difference, it's that the allocation size depends on factors that are only resolved at runtime. That's a major difference from static allocation where all this is known at compile time). -
@RememberMe Then in C++ static is also a modifier making that distinction muddy. We have dynamically allocated static variables... static pointer to heap memory.
-
@Demolishun nothing wrong there. A static pointer means that the *pointer variable* itself is static, not the thing it's pointing to.
I agree though, in general C/C++'s use of the static keyword is an absolute mess. It's generally a lifetime quantifier i.e. that a static thing is guaranteed to be around in the same place in memory for the duration of the program (so static in the sense that it's always guaranteed to stay at the same place, as opposed to C's usual automatic (stack allocated) variables and class members). It's not really the static in "static allocation".
It's also used to define functions that aren't visible outside a c file but I feel that's just inconsistency (in this case static is sort of opposite to extern).
static in the sense of static typing vs dynamic typing is different, it denotes something that is known at compile time. I suppose you could say C/C++ static variables are known at compile time and they always exist for the duration of the program regardless of anything else (i.e. the linker ensures they're there). It's a very different meaning however from const and constexpr, which are to do with the *values* a variable can take. -
@RememberMe I know, and people assign dynamic term to freaking everything under the sun.
-
@halfflat Is there an O type notation for the amount of space used? Like S(infinite) for all possible outcomes?
You have some awesome comments btw. -
@halfflat That would make for an awesome scifi. Where some scientist figures out how to calculate the outcome of humanity on the universe using some quantum computer. He discovers that the universe will be destroyed by mankind so he has to deal with that eventuality. Insert some plot twists, suppression of reality, etc. Maybe end movie with, "We are fucked, but the beer is good!" Insert really dark humor.
-
it's more of a synonym of "at runtime", than a buzzword.
dynamically generated mesh, for example. mesh that the code creates during runtime, using some algo.
Related Rants
Dynamic/Dynamically is used WAY to much in programming. What part of programming is NOT dynamic?
https://dictionary.com/browse/...
Depending upon your interpretation of the definition it can just mean: moving parts. Programming is all about moving parts.
I see things like "dynamically allocated array". Wtf does that even mean? (I get it, most likely means on heap) Say it specifically: it was allocated on the stack or the heap.
Apparently some people are just more energetic in their programming...
It becoming a really overused buzzword...
random
dynamic
dynamically