Timeline for Why do you have to link the math library in C?
Current License: CC BY-SA 4.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 29, 2022 at 0:37 | history | edited | Peter Mortensen | CC BY-SA 4.0 | Active reading [<https://en.wiktionary.org/wiki/likely#Adverb>]. Expanded. Removed historical information (that is what the revision history is for)—the answer should be as if it was written right now. Removed meta information (this belongs in comments). |
| Jun 23, 2009 at 18:14 | comment | added | Evan Teran | @earlz: the approach of having the math library request saving would be a terrible design. What if they use the FPU by some other means? The only sane approach (besides just always saving/restoring) would be to detect usage and then start saving/restoring. | |
| Jun 23, 2009 at 18:07 | history | edited | Evan Teran | CC BY-SA 2.5 | added 553 characters in body |
| Jun 23, 2009 at 17:27 | comment | added | Nosredna | If I recall correctly, the whole issue long predates floating point coprocessors even being on microprocessors. | |
| Jun 23, 2009 at 17:25 | comment | added | Earlz | Really it can very highly depend on the kernel. The math library the kernel uses could have a save_FPU_on_switch() function that turns it on, while others just detect if the FPU was touched. | |
| Jun 23, 2009 at 17:24 | comment | added | Evan Teran | of course if you manually use the FPU the kernel will still need to save/restore its state. I was saying that if you never use it (including not using libm) then it wont have to. | |
| Jun 23, 2009 at 17:20 | comment | added | ephemient | If you don't link with libm but touch the x87 FPU through other means (operations on floats, for example), the x86 kernel does need to save FPU state. I don't think this is a very good guess... | |
| Jun 23, 2009 at 17:13 | history | answered | Evan Teran | CC BY-SA 2.5 |