Jump to content
Wikipedia The Free Encyclopedia

Talk:Magic number (programming)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This article is rated C-class on Wikipedia's content assessment scale.
It is of interest to the following WikiProjects:
WikiProject icon Computing Mid‐importance
WikiProject icon This article is within the scope of WikiProject Computing , a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.ComputingWikipedia:WikiProject ComputingTemplate:WikiProject ComputingComputing
Mid This article has been rated as Mid-importance on the project's importance scale.
WikiProject icon Computer science Mid‐importance
WikiProject icon This article is within the scope of WikiProject Computer science , a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.Computer scienceWikipedia:WikiProject Computer scienceTemplate:WikiProject Computer scienceComputer science
Mid This article has been rated as Mid-importance on the project's importance scale.
Things you can help WikiProject Computer science with:
Archives: 1

Data type limits

[edit ]

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 type Integer 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

[edit ]

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?

[edit ]

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

[edit ]

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 ]

AltStyle によって変換されたページ (->オリジナル) /