2 ms·
> Where the compiler puts on stack the default value, whenever the function call doesn't include it. So if a dynamically linked library uses default values, an
by masklinn 4y ago
> Where the compiler puts on stack the default value, whenever the function call doesn't include it.
So if a dynamically linked library uses default values, and you make use of them, and the dynamically linked library decides to change its default values (e.g. a crypto library switches to more secure defaults), you don’t get the update until you recompile your own code.
That doesn’t sound great.
Isn’t it C# which uses this strategy, of embedding the defaults in the caller?
PS: I don’t think C is defined in terms of stack, and modern calling conventions use registers for at least the first few arguments.
- Joker_vD 4y agoThat's IIRC how C++ also does this, so... yeah, it's not great but lots of things are not great about C and/or C++ and the standard advice is "yeah, don't do that if that hurts".