Live data from Hacker News

Ntimed – NTPD replacement

github.com

31–40 of 109 posts

Re: Ntimed – NTPD replacement

#31

Earlier quoted context omitted.

Section 7.19.3.

I'm getting 7.21.3, reading here[1], but that's the draft spec for C11. I couldn't find the official one anyhere. [1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

Oh, I'm still bumming around with a copy of C99. Now that I'm here, I'll add the definition of streams in the previous section is probably the more interesting part, since that's the term used for the idea of abstracting tapes and terminals.

Re: Ntimed – NTPD replacement

#32
Why the hell would you write this in C, when so many other programming languages exist now. I mean, you could write a time sync program in Python today. But if you still want to be maximally performant since you intend to run on millions of computers, Go and Rust are new and fresh and memory safe, and modern C++ is great too. A lot better than malloc and pointer arithmetic.

I get that the original ntpd is almost 20 years old, and opentpd is about a decade old, and back then writing every in C was forgivable, because the alternates were not as far ahead in every metric possible as they are today. Now it just looks like someone trying to use Cobol or Fortran in new production products.

Re: Ntimed – NTPD replacement

#33
post #27
post #18

Earlier quoted context omitted.

Abstractions are what make it possible to reason about complex systems. Being able to ignore parts of your codebase is the only way to make changes to it once it gets beyond a trivial size. The whole of the Unix philosophy is enforcing this policy of strong abstractions by making each part of a complex overall system its own binary, such that they can only communicate using the file I/O abstraction, possibly via pipe…

Lifting up constants into defines/consts and DRYing up C code makes for shorter, less error-prone and easier-to-understand codebases. Eg there's no reason to continue writing code like it's 1960's because we can steal good software eng and maintainability lessons from everything that has come since. (If one must maintain absolute portability.) PS: I would like to see a toolchain for Go that emits portable C instead o…

It's not "writing like 1960's programming' gratuitous abstraction just creates a burden for the programmer to dig through, it makes reasoning a pain.

Re: Ntimed – NTPD replacement

#35
post #32

Why the hell would you write this in C, when so many other programming languages exist now. I mean, you could write a time sync program in Python today. But if you still want to be maximally performant since you intend to run on millions of computers, Go and Rust are new and fresh and memory safe, and modern C++ is great too. A lot better than malloc and pointer arithmetic. I get that the original ntpd is almost 20 y…

I think Rust should be the default choice from projects like this going forward.

Re: Ntimed – NTPD replacement

#36
post #16

Earlier quoted context omitted.

What safer options are there with equal size, overhead (read: none) and not full of layers upon layers of abstractions?

Can you explain why abstraction is bad? Abstraction does _not_ mean your program will be slower. In fact, the opposite can happen, because the compiler has more context to work with, and can get rid of stuff. Haskell + stream fusion gives better results than well tuned C in some very typical situations http://research.microsoft.com/en-us/um/people/simonpj/papers... Even just comparing C++/C, C++'s templating mechanis…

Abstraction in my definition is hiding of complexity and it does just that.

Re: Ntimed – NTPD replacement

#37
post #16

Earlier quoted context omitted.

What safer options are there with equal size, overhead (read: none) and not full of layers upon layers of abstractions?

Can you explain why abstraction is bad? Abstraction does _not_ mean your program will be slower. In fact, the opposite can happen, because the compiler has more context to work with, and can get rid of stuff. Haskell + stream fusion gives better results than well tuned C in some very typical situations http://research.microsoft.com/en-us/um/people/simonpj/papers... Even just comparing C++/C, C++'s templating mechanis…

The problem with abstraction is that in order to deterministically control performance, you have to break down all the walls of the abstraction anyway. If I'm not 100% confident that my compiler will optimize a vector op with SIMD, and I absolutely require SIMD performance, then I end up having to know the entire layer cake to be able to verify that it is doing exactly that.

In most cases it isn't a bad thing at all. But a use case like a timekeeping daemon, where a single unexpected garbage collection pause could cause a world of problems, it most definitely is more pain than gain.

Re: Ntimed – NTPD replacement

#38
post #32

Why the hell would you write this in C, when so many other programming languages exist now. I mean, you could write a time sync program in Python today. But if you still want to be maximally performant since you intend to run on millions of computers, Go and Rust are new and fresh and memory safe, and modern C++ is great too. A lot better than malloc and pointer arithmetic. I get that the original ntpd is almost 20 y…

it's easy to criticize someone's choice of language or coding style with generalities--and i don't necessarily even disagree with the substance of your criticism--but it's also important to note that building free software for freedom is much, much harder than any two-paragraph comment you or i might write.

imperfect as it may be, i'm grateful that phk was willing to build something that people can freely choose while contributing mutual aid and solidarity to the free software community--instead of snark.

Re: Ntimed – NTPD replacement

#39
post #32

Why the hell would you write this in C, when so many other programming languages exist now. I mean, you could write a time sync program in Python today. But if you still want to be maximally performant since you intend to run on millions of computers, Go and Rust are new and fresh and memory safe, and modern C++ is great too. A lot better than malloc and pointer arithmetic. I get that the original ntpd is almost 20 y…

Yeah. I think we've hit the point where we need to start discouraging the proliferation of C and C++ (in my opinion). It seems silly that we cling to languages from the 80's and earlier when modern languages have advanced so far.

Re: Ntimed – NTPD replacement

#40
post #8

Earlier quoted context omitted.

The appropriate systems language for use on UNIX and Linux is C. The entire interface is based on C conventions. Sometimes, when all you have is nails, you really ought to reach for a hammer.

I seriously think the C-hater crowd on HN is just disappointed that they can't reason well about pointers. They can't write good C so no one can! It needs, like, more javascript, man. (Preemptive response to downvoters: please have a sense of humor about yourselves. :P)

You realize that the most vociferous of those decrying this language choice come from the proponents of a language that has 3 different types of pointers, right?

You should check out Rust and Go. Their users are most definitely among those who fail to understand C pointers.

Post reply on HN