Live data from Hacker News

µUBSan: clean-room reimplementation of the Undefined Behavior Sanitizer runtime

blog.netbsd.org

61–65 of 65 posts

Re: µUBSan: clean-room reimplementation of the Undefined Behavior Sanitizer runtime

#61

>I've decided to write the whole µUBSan runtime as a single self-contained .c soure-code file, as it makes it easier for it to be reused by every interested party. I don't really get why people do this. Linking is one of the easiest and most broadly supported features of C environments on every platform.

You're not going to like how PuTTY is written then either. The entire initial portion of the SSHv2 protocol, from version string exchange to the end of user authentication, is coded as one huge (10Kloc) C function that uses a macro-driven Duff's device to implement co-routine behavior (it's all async I/O under the covers). To me, one huge file or many small ones doesn't matter all that much because I have cscope on m…

https://github.com/qt/qtbase/blob/5.11/src/widgets/kernel/qw... is the largest no-nonsense C++ file I've ever seen https://github.com/borgbackup/borg/blob/master/src/borg/arch... ditto for Python

Personally files this large become just very annoying overall. Code review tools tend to become slow on them (e.g. Gerrit is super-slow with files that are quite a bit smaller than qwidget.cpp), navigation is only possible via symbols, the import / include area becomes a huge mess (which also tends to generate constant merge conflicts, because imports are a common hot area for writes) etc.

Re: µUBSan: clean-room reimplementation of the Undefined Behavior Sanitizer runtime

#63

Earlier quoted context omitted.

OK, sure, https://news.ycombinator.com/user?id=Sir_Cmpwn's comment was: > > I've decided to write the whole µUBSan runtime as a single self-contained .c soure-code file, as it makes it easier for it to be reused by every interested party. > I don't really get why people do this. Linking is one of the easiest and most broadly supported features of C environments on every platform. Sure, this is true, and users already…

I totally agree with you, I personally love single file implementations. I was just trying to explain what I thought his argument was against them, since I don't think he really explicitly stated it outside of generally speaking of maintenance issues. He just said he would prefer to contribute patches to a project that had multiple files and a makefile based build system. I was assuming his argument was about the fut…

Fair enough.

Re: µUBSan: clean-room reimplementation of the Undefined Behavior Sanitizer runtime

#64
post #24

Earlier quoted context omitted.

And what dependency management or package system would you use to install that library? Distributing the source, especially for self contained libraries, is easily managed with the rest of your source code.

Sure, I'm all for distributing the source. Doesn't mean it needs to be a single file. It should probably have a makefile which spits out an archive file, which you link to in your application.

Please allow that mess of using ar to work in LTO mode, i.e., allow bypassing the ar or replacing it with the compiler in linking mode, or something. Basically don't use ar in a way that breaks LTO.

LTO is awesome, as some code does benefit from optimizing for a minute to get 5% more speed for the next week (and sometimes even more aggressive parameters for the optimizer, if you run the code for long enough to matter).

Re: µUBSan: clean-room reimplementation of the Undefined Behavior Sanitizer runtime

#65

Earlier quoted context omitted.

You're not going to like how PuTTY is written then either. The entire initial portion of the SSHv2 protocol, from version string exchange to the end of user authentication, is coded as one huge (10Kloc) C function that uses a macro-driven Duff's device to implement co-routine behavior (it's all async I/O under the covers). To me, one huge file or many small ones doesn't matter all that much because I have cscope on m…

https://github.com/qt/qtbase/blob/5.11/src/widgets/kernel/qw... is the largest no-nonsense C++ file I've ever seen https://github.com/borgbackup/borg/blob/master/src/borg/arch... ditto for Python Personally files this large become just very annoying overall. Code review tools tend to become slow on them (e.g. Gerrit is super-slow with files that are quite a bit smaller than qwidget.cpp), navigation is only possible v…

Oh yes, past some size things get slow and obnoxious, no doubt.
Post reply on HN