Update:
Surprised that it is being so heavily downvoted...
The question is coding-related and before asking this question I have googled for "42" in combination with:
And I am not an expert/fan of Western culture/literature.
Also found, Why are variables “i” and “j” used for counters? [duplicate] which was not closed but even protected.
I feel that everybody knows it, except me...
What is the origin of ubiquitous magic digit 42 used all over the code samples and samples?
How have you come using 42? because I have not ever come or ever used 42
After some search, I found MSDN doc on it: Magic Numbers: Integers:
Well, this did not explain me anything.
Which movies and books have I missed for all those years of being involved in development, coding and programming and around-IT related activities like rwquirements analysis, system administration, etc??
Jérôme Laban. C# Async Tips and Tricks, Part 3: Tasks and the Synchronization Context
var t = Task.Delay(TimeSpan.FromSeconds(1)) .ContinueWith ( _ => Task.Delay(TimeSpan.FromSeconds(42)) );
MSDN Asynchronous Agents Library
send(_target, 42);
Quickstart: Calling asynchronous APIs in C# or Visual Basic
Office.context.document.setSelectedDataAsync( "<html><body>hello world</body></html>", {coercionType: "html", asyncContext: 42}, function(asyncResult) { write(asyncResult.status + " " + asyncResult.asyncContext);
Asynchronous Programming in C++ Using PPL
task<int> myTask = someOtherTask.then([]() { return 42; });
Boxing and Unboxing (C# Programming Guide)
Console.WriteLine(String.Concat("Answer", 42, true));
How To: Override the ToString Method (C# Programming Guide)
int x = 42;
Trace Listeners
// Use this example when debugging. System.Diagnostics.Debug.WriteLine("Error in Widget 42"); // Use this example when tracing. System.Diagnostics.Trace.WriteLine("Error in Widget 42");
|| Operator (C# Reference
// The following line displays True, because 42 is evenly // divisible by 7. Console.WriteLine("Divisible returns {0}.", Divisible(42, 7)); // The following line displays False, because 42 is not evenly // divisible by 5. Console.WriteLine("Divisible returns {0}.", Divisible(42, 5)); // The following line displays False when method Divisible // uses ||, because you cannot divide by 0. // If method Divisible uses | instead of ||, this line // causes an exception. Console.WriteLine("Divisible returns {0}.", Divisible(42, 0));
WIKIPedia C Sharp (programming language)
int foo = 42; // Value type.
In ASCII language, the most basic computer software, '42′ is the designation for an asterisk. So, when Deep Thought was asked what the true meaning of life was, it answered as you might think a computer would - 42, in other words, “Anything you want it to be!”
In programming, a magic number is a constant value used to identify a file format, protocol or error code. In many file formats, the first few bytes identify the file; for example, "PK" in ZIP files and the hex values "F8 D8" in JPEG files.
Miller repeated his tests across multiple categories of learning and processing, from vision, to hearing, to memory recall, and the results were unanimous: people appear to be able to process and recall between five and nine pieces of information at any one time. Hence, the magic number seven, plus or minus two.
A magic number is a numeric literal that is used in the code without any explanation of its meaning. The use of magic numbers makes programs less readable and hence more difficult to maintain and update.
It's from The Hitch Hiker's Guide to the Galaxy.
In The Hitchhiker's Guide to the Galaxy (published in 1979), the characters visit the legendary planet Magrathea, home to the now-collapsed planet-building industry, and meet Slartibartfast, a planetary coastline designer who was responsible for the fjords of Norway. Through archival recordings, he relates the story of a race of hyper-intelligent pan-dimensional beings who built a computer named Deep Thought to calculate the Answer to the Ultimate Question of Life, the Universe, and Everything. When the answer was revealed to be 42, Deep Thought explained that the answer was incomprehensible because the beings didn't know what they were asking. It went on to predict that another computer, more powerful than itself would be made and designed by it to calculate the question for the answer. (Later on, referencing this, Adams would create the 42 Puzzle, a puzzle which could be approached in multiple ways, all yielding the answer 42.)
The answer is, as people already have stated, The Hitchhiker's Guide to the Galaxy.
I made a little experiment and put a couple of numbers in the search field, and these are the results:
It seems like 42 beats its neighbors clearly, but it can't touch regular numbers like 40, 45 and 50, no matter how magical it is.
It would be interesting to do the same search in source code only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With