Talk:Magic number (programming)

Does § Data type limits really belong in this article? I'm not saying it doesn't belong somewhere, but I am not sure that it belongs here. These limits ar

Talk:Magic number (programming)

Data type limits

Does § Data type limits really belong in this article? I'm not saying it doesn't belong somewhere, but I am not sure that it belongs here. These limits are not really magic numbers, they are fundamental. The article Integer (computer science), to which Integer typeInteger type redirects, has them, but only in decimal (and in a sense they are "magic" in decimal as seemingly arbitrary, whereas in hex they are plainly not). I am tempted to add the hex into the Integer article and delete this section: there are no redirects to it, but of course other articles might link to it, and I would check thoroughly they are retargeted if consensus were to make that move.

For that matter, the section should probably be renamed "Integer type limits". 94.21.38.126 (talk) 10:17, 29 November 2019 (UTC)Reply

I had the same remark. The only justification to keep these limits here would be to provide the name to use instead of writing these magic numbers in code, example INT_MAX in C/C++, however that would become a list of names specific to each language. A reference to headers like <limits.h> in the section "Unnamed numerical constants" should be enough for that article. Teuxe (talk) 13:19, 3 August 2023 (UTC)Reply
I think you're right. Dingolover6969 (talk) 01:39, 20 April 2025 (UTC)Reply
Does it belong? no! I deleted it. Has nothing to do with magic numbers. Stevebroshar (talk) 21:45, 29 August 2025 (UTC)Reply

Advantages of naming magic constants

The second and last item in the list of advantages,

  • It is easier to alter the value of the number, as it is not duplicated. [...]
  • It facilitates parameterization. [...]

strike me as saying essentially the same thing. I would suggest merging the former into the latter. Mjaðveig (talk) 09:30, 25 September 2023 (UTC)Reply

All CP/M functions are run by call 0005h?

Would the number `0005h` qualify? (https://retrocomputing.stackexchange.com/questions/24899/why-does-cp-m-use-call-0005h-for-its-syscalls)

Ceplm (talk) 13:40, 13 January 2025 (UTC)Reply

The "unnamed constant" sense of this phrase should be moved to its own page

I think we ought to split this page into something like magic number (file signature) and magic number (unnamed constant). I'm not married to those names. In fact, we should probably pick different ones, in accordance with Wikipedia guidelines.

These two concepts just happen to have the same name (among other names) and both happen to be used in computing. There's no reason they should share a wikipedia page (Wikipedia is an encyclopedia, not a dictionary, after all).

The GUID and debug value senses can go with the file signature sense, as they're a very similar concept. If one page remains "Magic number (programming)", then I think it should be the file signature sense. Dingolover6969 (talk) 01:48, 20 April 2025 (UTC)Reply

I had said that I agree with the split, but I'm editing my comment now to say that IDK. After some thought I have found a similarity amoung all of the meanings. A magic number is a numeric value that has a special meaning, but without extra knowledge, that meaning is or might be mysterious; less than clear. That manifests differently in different contexts. In programming, that's usually a numeric literal. And for file identification, it's an embedded value. But, they are otherwise the same sort of thing.Stevebroshar (talk) 21:50, 29 August 2025 (UTC)Reply

"typing 'dekSize' instead of 'deckSize' would result in the compiler's warning that dekSize is undeclared"

If the variable be accidentally named dekSize, but the later code does not account for that, it would be deckSize that is left undeclared. Alfa-ketosav (talk) 19:09, 19 April 2026 (UTC)Reply

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.