On the Effectiveness of nonnull: Difference between revisions

No edit summary
No edit summary
Line 1: Line 1:
'''[[Dankblog|dankblog!]] 2021-11-05, 0236 EDT, at [[Viewpoint|the danktower]]'''
'''[[Dankblog|dankblog!]] 2021-11-05, 0236 EDT, at [[Viewpoint|the danktower]]'''


I add <code>nonnull</code> [https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html annotations] to my [[C]] programs pretty religiously, making most frequent use of:
I add [https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html annotations] to my [[C]] programs pretty religiously, making most frequent use of:


* <tt>const</tt> and <tt>pure</tt> -- facilitate subexpression hoisting and memoization
* <tt>const</tt> and <tt>pure</tt> -- facilitate subexpression hoisting and memoization
Line 17: Line 17:
<tt>access</tt> lets you get fine-grained, Ada-like controls on your variable access types, but if i were writing Ada i'd be fucking with <tt>gnat</tt> and working for Northrop Grumman and questioning my life choices.
<tt>access</tt> lets you get fine-grained, Ada-like controls on your variable access types, but if i were writing Ada i'd be fucking with <tt>gnat</tt> and working for Northrop Grumman and questioning my life choices.


anyway, <tt>nonnull</tt> is all over the place, but it's usually added merely to satisfy the spergy part of my brain that also forces me to compulsively run <tt>ls</tt> every time i switch between terminals just to, like, ensure nothing shifted around. a pleasant surprise today when it caught a bug in my existing code:
finally, <tt>nonnull</tt> is all over the place, but it's usually added merely to satisfy the spergy part of my brain that also forces me to compulsively run <tt>ls</tt> every time i switch between terminals just to, like, ensure nothing shifted around. a pleasant surprise today when it caught a bug in my existing code:


<syntaxhighlight lang="c">
<syntaxhighlight lang="c">