You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
- 2Ok, maybe it does depend more on the language, but in C#, you would likely do: if (timeout.HasValue) instead of a direct comparison to null.Matt H– Matt H2012-03-30 16:59:16 +00:00Commented Mar 30, 2012 at 16:59
- 2Null isn't any worse than magic number. With magic numbers, you never know what the magic number is... it could be 0, -1, or something else. null is just null.marco-fiset– marco-fiset2012-03-30 17:22:54 +00:00Commented Mar 30, 2012 at 17:22
- 9Null means absence of value. This is the concept that a lot of magic numbers are intending to express. Being able to use null with a nullable type is a MUCH better solution than picking one arbitrary value from the range of possible values for a data type.17 of 26– 17 of 262012-03-30 17:32:11 +00:00Commented Mar 30, 2012 at 17:32
- 2Using "null" as your magic value, if your type has "null," is fine. The important thing is to NAME it, because sure as shootin' the next guy to come along will not know what you meant. Null can mean "infinity," "not yet specified," "bug in the code that created the data structure," or any number of other things. Only a name lets the next coder know that you meant that value to be there, and what behavior you meant it to trigger.mjfgates– mjfgates2012-03-30 17:49:31 +00:00Commented Mar 30, 2012 at 17:49
- 2-1: Null is better than a magic number. A magic number can easily be misinterpreted as data.kevin cline– kevin cline2012-04-02 20:25:32 +00:00Commented Apr 2, 2012 at 20:25
| Show 3 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you