Hacker Blogs
Work in progress: 15,409 of 181,233 sites checked so far, more every week · updated 2 Nov 2026Missing a blog? Tell us

Top all-time · #1643

N

Nick Sazonov

Personal blog · port70.netprogrammingwriting

Nick Sazonov writes Gopher:, a personal blog at port70.net about programming and writing. Since 2009, 47 different Hacker News readers have linked it 110 times, most often “C89 Draft Standard in HTML”. No feed was found, so read it on the site itself.

No feed foundVisit the blog
110mentions?
47HN people?
2009–2026first – last linked?
Links on Hacker News per year · peak 18 in 2022

Most-linked posts?

  1. /~nsz/c/c89/c89-draft.html
    3 people · 3 mentions · first linked 2019-09-29
  2. C89 Draft Standard in HTML
    2 people · 3 mentions · first linked 2022-01-24
  3. /~nsz/c/c11/n1570.html
    2 people · 2 mentions · first linked 2016-05-20

What Hacker News says?

  1. I think that this rule applies to C89 too. I don't have an official copy of the standard, but I found a draft here: http://port70.net/~nsz/c/c89/c89-draft.html#3.5.7 “If there are fewer initializers in a list than there are members of an aggregate, the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration.”

    Comment linking /~nsz/c/c89/c89-draft.html

    on “How to C in 2016”
  2. Submitted Arc4random in libressl 2.0.2 as a story · 15 points

    HN discussion
  3. A typedef to a character type is a character type. See http://port70.net/~nsz/c/c11/n1570.html#6.7.8p3 . http://port70.net/~nsz/c/c11/n1570.html#6.2.5p4 leaves open the option for extended signed integer types, and the following paragraph provides for an unsigned integer type for each signed type, extended signed types included. So it would be perfectly possible, if not actually very reasonable - not that this is st…

    Comment linking /~nsz/c/c11/n1570.html

    on “How to C in 2016”
  4. Submitted The Anti-web Manifesto as a story · 4 points

    HN discussion
  5. I found a web version of the draft standard, so here are some links: 6.2.5.15 - http://port70.net/~nsz/c/c11/n1570.html#6.2.5p15 6.3.2.3.7 - http://port70.net/~nsz/c/c11/n1570.html#6.3.2.3p7 B.19 - actually I think 7.20.1 is a better demonstration that these are integer types (and not, since it's never mentioned, character types) - http://port70.net/~nsz/c/c11/n1570.html#7.20.1 7.20.1.1.3 - http://port70.net/~nsz/c/…

    Comment linking /~nsz/c/c11/n1570.html

    on “How to C in 2016”
  6. Submitted The Development of the C Language [pdf] as a story · 3 points

    HN discussion
  7. The sized types are optional, since they are more restrictive than the ordinary types - see section 7.20.1.1 in the standard ( http://port70.net/~nsz/c/c11/n1570.html#7.20.1.1 ). To summarize: intN_t is exactly N bits, with zero padding bits, and 1 2's complement sign bit; uintN_t is exactly N bits, with zero padding bits; the implementation must provide such typedefs for all such types it supports. So, if a system…

    Comment linking /~nsz/c/c11/n1570.html

    on “How to C in 2016”
  8. Submitted C89 Draft Standard in HTML as a story · 2 points

    HN discussion
  9. That may be the case in C++, but in C infinite loops are allowed as long as the controlling condition is a constant expression (making it clear that the developper intends an infinite loop). These infinite loops without side-effects are even useful from time to time in embedded software, so it was natural for the committee to allow them: https://port70.net/~nsz/c/c11/n1570.html#6.8.5p6 And you now have all the detai…

    Comment linking /~nsz/c/c11/n1570.html

    on “Tell HN: C Experts Panel – Ask us anything about C”
  10. Submitted Dennis Ritchie's criticisms of an early draft of C89 as a story · 1 points

    HN discussion
  11. The only thing that is not defined is comparing a pointer one-past-the-end to a pointer to the very beginning of a toplevel object. Apart from this rule, pointers of course do not need to be derived from the same object in order to be compared with == and !=. &a + 1 == &b is unspecified: it may produce 0 or 1, and it may not produce the same result if you evaluate it several times. Similarly, if both the char pointe…

    Comment linking /~nsz/c/c11/n1570.html

    on “Tell HN: C Experts Panel – Ask us anything about C”
  12. The C standard also allows to use memcpy to do type punning: If a value is copied into an object having no declared type using memcpy or memmove, or is copied as an array of character type, then the effective type of the modified object for that access and for subsequent accesses that do not modify the value is the effective type of the object from which the value is copied, if it has one Simply memcpy into a variab…

    Comment linking /~nsz/c/c11/n1570.html

    on “Tell HN: C Experts Panel – Ask us anything about C”
  13. I don't have my copy of K&R handy, but this distinction has existed since the initial codification. From C89: 3.1.2.5 Types [...] A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting unsigned integer type. Source:…

    Comment linking /~nsz/c/c89/c89-draft.txt

    on “The C23 edition of Modern C”
  14. I usually like to keep copies of the C standards drafts with me. In case anyone is interested, here are the links: In case, someone is interested here are the various C standards drafts: * C89/C90: http://port70.net/~nsz/c/c89/c89-draft.html * C99 (N1256): http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf * C11 (N1570): http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf * C17/C18 (N2176): https://web.…

    Comment linking /~nsz/c/c89/c89-draft.html

    on “Modern C”
  15. %n was defined in C89, the first C standard: http://port70.net/~nsz/c/c89/c89-draft.html#4.9.6.1 Looking at old source code, the earliest implementation I found is 4.3BSD Tahoe (1988). See https://www.tuhs.org/cgi-bin/utree.pl?file=4.3BSD-Tahoe/usr/... Second oldest I found was Tenth Edition [Research] Unix (1989). See ocvt_n at https://www.tuhs.org/cgi-bin/utree.pl?file=V10/libc/stdio/vf... I couldn't find support…

    Comment linking /~nsz/c/c89/c89-draft.html

    on “Best of show – abuse of libc”
  16. this is utter nonsense. in C, since before C89, all non-zero values are considered true in conditional contexts (if, for, while, ?:). http://port70.net/~nsz/c/c89/c89-draft.html#3.6.4.1 . false must therefore be exactly zero. !1 is also always 0, as it must be. http://port70.net/~nsz/c/c89/c89-draft.html#3.3.3.3 .

    Comment linking /~nsz/c/c89/c89-draft.html

    on “Let's Destroy C”
  17. >The wording was changed in C11 And here's an exact quote from the C11 standard: >If the quotient a/b is representable, the expression (a/b)*b + a%b shall equal a; otherwise, the behavior of both a/b and a%b is undefined. http://port70.net/~nsz/c/c11/n1570.html#6.5.5p6

    Comment linking /~nsz/c/c11/n1570.html

    on “Integers in C quiz”
  18. That's true, but it doesn't matter to the point being made. According to the standard[1], if short and int have the same size (even if not the same rank) both numbers are converted to unsigned int (that is, the unsigned integer type corresponding to int) because int can't represent all values of unsigned short. The usual arithmetic conversions never "promote" an unsigned to signed if doing so would change the value.…

    Comment linking /~nsz/c/c99/n1256.html

    on “Integers in C quiz”
  19. `size_t` is defined as > the unsigned integer type of the result of the sizeof operator ( https://port70.net/~nsz/c/c11/n1570.html#7.19p2 ) `sizeof` returns the following: > If the type of the operand is a variable length array type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an integer constant. ( https://port70.net/~nsz/c/c11/n1570.html#6.5.3.4p2 ) So `sizeof(size_t)` must…

    Comment linking /~nsz/c/c11/n1570.html

    on “C99 doesn't need function bodies, or 'VLAs are Turing complete'”
  20. Any time somebody tells you how simple C is by comparison, point them at https://port70.net/~nsz/c/c11/n1570.html#6.2.4p5 : > An object whose identifier is declared with no linkage and without the storage-class specifier static has automatic storage duration, as do some compound literals. The result of attempting to indirectly access an object with automatic storage duration from a thread other than the one with whi…

    Comment linking /~nsz/c/c11/n1570.html

    on “Bug in reader/writer locks in Windows API”
  21. This, the standard document itself (it's not very long, and drafts are freely available), and the C tag on stackoverflow (often contains comprehensive answers by well informed people) are my recommended resources. http://port70.net/~nsz/c/c11/n1570.html http://port70.net/~nsz/c/c11/n1570.pdf http://stackoverflow.com/questions/tagged/c A good way to casually browse SO for interesting information is filtering by quest…

    Comment linking /~nsz/c/c11/n1570.pdf

    on “To become a good C programmer (2011)”
  22. Realloc's behaviour is well-defined: https://port70.net/~nsz/c/c11/n1570.html#7.22.3.5p3 If the size of the space requested is zero, the behavior is implementation-defined: https://port70.net/~nsz/c/c11/n1570.html#7.22.3

    Comment linking /~nsz/c/c11/n1570.html

    on “Memory Allocators 101 – Write a simple memory allocator (2016)”
  23. If you like that, there is yet another seldom seen feature of c99, the use of ' ' in an array declarator: echo 'int my_func(int i, int arr[*]);' > main.c gcc -c -std=c99 main.c -- * observe that there are no errors * -- See 6.7.5.2 Array declarators for details http://port70.net/~nsz/c/c99/n1256.html Edit: I can't figure out how to escapse an asterisk, so the above might not read correctly but I tried.

    Comment linking /~nsz/c/c99/n1256.html

    on “A little-known C feature: Static array indices in parameter declarations (2013)”
  24. VLAs are optional in C11: https://port70.net/~nsz/c/c11/n1570.html#6.10.8.3

    Comment linking /~nsz/c/c11/n1570.html

    on “The Evolution of C Programming Practices: A Study of Unix (2016) [pdf]”
  25. > E.g. you can't memcpy a uint64 to a double and expect well-defined behavior. Yes, you can. The behavior is implementation-defined but not undefined. (Well, it can trigger undefined behavior if the value corresponds to a signaling NaN, or if the implementation uses a nonstandard, non-IEEE format for doubles that has other "trap representations". But it's not otherwise undefined.) The basis for this is that the alia…

    Comment linking /~nsz/c/c11/n1570.html

    on “Torvalds: Standards need to be questioned”
  26. The draft versions of the spec (functionally equivalent to the published versions) are freely available. I believe that the opensource compilers explicitly target those draft versions; but even if not, there's nothing in the release version that's not in the draft. You can even get fancy html formatted versions that somebody made - https://port70.net/~nsz/c/

    Comment linking /~nsz/c/

    on “C will never stop you from making mistakes”
  27. Meanwhile, C89: https://port70.net/~nsz/c/c89/c89-draft.html#3.3.5 > When integers are divided and the division is inexact, if both operands are positive the result of the / operator is the largest integer less than the algebraic quotient and the result of the % operator is positive. If either operand is negative, whether the result of the / operator is the largest integer less than the algebraic quotient or the sma…

    Comment linking /~nsz/c/c89/c89-draft.html

    on “Python, unlike C, has the mod operator always return a positive number”
  28. The portion you quoted derives word-for-word from the original ANSI standard (C89/C90): https://port70.net/~nsz/c/c89/c89-draft.html#3.5.2.1

    Comment linking /~nsz/c/c89/c89-draft.html

    on “Writing memory efficient C structs”
  29. > It was a workaround (unreliable at that, IIRC) for compilers getting more aggressive in ignoring the intentions of C, including the early standards. But volatile was in C89? So how can it be a response to compilers "ignoring the intentions of C" in the early standards? If anything, an example in the C89 standard makes it very explicit that an implementation may do exactly what gpderetta said (emphasis added): > An…

    Comment linking /~nsz/c/c89/c89-draft.html

    on “ISO C became unusable for operating systems development”
  30. > Not if the compiler is run at some (hopefully available) "absolute vanilla" Not this straw man again, please! You can optimise, as long as you keep the semantics of the code. When what the programmer wrote conflicts with an optimisation the compiler would like to perform: "- Trust the programmer." http://port70.net/~nsz/c/c89/rationale/a.html So if the compiler wanted to put a 4 element array in registers as an op…

    Comment linking /~nsz/c/c89/rationale/a.html

    on “ISO C became unusable for operating systems development”

Search all of HN for port70.net

Linked by the same people?