Jump to content

Talk:Magic number (programming)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Skarz (talk | contribs) at 22:19, 10 March 2024 (OneClickArchived "Unnamed numerical constants" to Talk:Magic number (programming)/Archive 1). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Bad coding practices 101

This article needs a link to another article listing bad coding practices. — Preceding unsigned comment added by 206.132.109.103 (talk) 16:13, 8 June 2017 (UTC)[reply]

Hello fellow Wikipedians,

I have just modified 2 external links on Magic number (programming). Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 5 June 2024).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 14:46, 10 December 2017 (UTC)[reply]

Extended Justification for Most Recent Edit

Some four years ago I added a note to 0xFDFDFDFD that certain debug versions of Win32 functions will flood fill 0xFD during their operation. I chose to add this note to Wikipedia because I had spent significant time looking for what function was responsible for flood filling this magic number in an application I was working on; it is not particularly easy to discover this fact as it is buried halfway through a very large article on this function and does not get mentioned in most places that discuss magic numbers, and I wanted to spare the next poor individual the same agony.

Today I was trying to remember what functions those were, and when I went to the article expecting to see my edit, I found out that it had been removed within about 10 minutes after having been made. I will assume on good faith that the person who removed my edit thought I was being unconstructive. The person in question does not appear to have programming experience (based on reviewing their contributions), so I do not know what criteria that user judged my edit by. The function I listed does not allocate or deallocate memory, so it is entirely separate from the malloc() comment for the same entry. My static IP has made other edits that were fixing typos and had no prior evidence of vandalism. I added a specific citation to MSDN regarding the function in question in the hopes that it isn't reverted again, but I note that most entries do not have any citations and do not end up reverted.

Furthermore, I noticed the entry for D15EA5E had a comment to the effect "Should this be D15EA5ED "Diseased"" It just so happens that I have extensive experience with the Nintendo Wii hardware platform. I know for a fact that the entry is 0D15EA5E; there is no D at the end, and it begins with 0. Look at address 32 (hex 0x20) of any Wii or GameCube ROM with a hex editor.

Finally, I noticed that one entry referred to "uninitialised". While this is British spelling, Wikipedia itself has an article Uninitialized variable but lacks Uninitialised variable. Therefore, I felt justified changing the word. Cheers 98.111.204.114 (talk) 22:11, 16 January 2019 (UTC)[reply]

Magic Number for PDF

Not sure how to change this because so many sources on this conflict each other. However, in the PDF Reference edition 2, it mentions that for many viewers, the magic number only has to appear somewhere in the first 1024 bytes, and not necessarily the first 4 bytes. Skyturnrouge (talk) 22:36, 14 November 2019 (UTC)[reply]

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 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]

PowerPC Mach-O binaries on Apple Inc.'s macOS platform?!?!?

Fromerly the FEEDFACE Entry read: | FEEDFACE || "Feed face", Seen in PowerPC Mach-O binaries on Apple Inc.'s macOS platform. On Sun Microsystems' Solaris, marks the red zone

Now, I'm very puzzled by this because "MacOS" has never run on PowerPC. OS X 10.5, Leopard (2007) was the last OS to support PowerPC architecture. Perhaps they didn't purge all the PowerPC code, although much of this would also be 32-bit rather than the 64-bit... It just doesn't make much sense that the code would remained buried in there. I replaced it with "Mac OS X" unlinked, as I'm not entirely certain that this doesn't extend past OS X Leopard 10.5 and into Snow Leopard 10.6, for example. Also, linking "Mac OS X" and "OS X" and "OSX" just redirects to "MacOS", so that wouldn't clarify the issue, and just lead to the same confusion. 75.71.166.197 (talk) 01:57, 16 February 2022 (UTC)[reply]

DEC PDP 11/x

DEC PDPs have some affinity to 8x1777777 ( its an octal number ). I will find out, and document it here. — Preceding unsigned comment added by 2600:1700:87D3:22E0:1008:10E6:55:AF7B (talk) 03:36, 3 September 2022 (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]