pw201 + c   16

Type punning isn't funny: Using pointers to recast in C is bad.
A common C programming technique (casting between pointers to structures) leads to problems when strict aliasing is turned on (as it is if you set -O2 -O3 in gcc).
C  programming  casting  punning 
january 2019 by pw201
Deep C (and C++)
The differences between shallow and deep understanding in C/C++ or how to ace the technical interview.
programming  C  interview 
july 2018 by pw201
Delta Pointers: Buffer Overflow Checks Without the Checks
Using the top bytes of pointers to implement efficent out-of-bound detection.
security  C  pointer  programming  overflow 
april 2018 by pw201
Bit Twiddling Hacks
A collection of code snippets for doing useful things (sign extension, determine whether a number is a power of two, and so on).
bit-twiddling  programming  algorithms  c  hacks  twiddling 
october 2016 by pw201
cmocka - unit testing framework for C
Nifty unit test framework which does the checking arguments and providing return values from stub/mocked functions which I tend to spend a bit of time re-creating each time I write a test.
test  development  programming  testing  unit-test  C 
march 2015 by pw201
Embedded in Academia : Proposal for a Friendly Dialect of C
John Regehr and friends note that C compilers aggressive optimising around use of constructs the spec says are "undefined" can lead to unexpected behaviour. They propose a friendly C dialect where compilers would produce unspecified values in response to use of these constructs, but would not feel free to make demons fly out of your nose.
C  programming  language  software-engineering 
august 2014 by pw201
Printable True Bugs Wait Posters | natashenka
Abstain from strcpy! Wait for the string handling functions which are right for you.
programming  funny  security  bugs  C  stdlib 
february 2014 by pw201
The Descent to C
Simon Tatham introduces C to people who've only worked in high level languages, the innocent little darlings. You 'ad array bounds checking? You were lucky!
C  programming  language 
january 2014 by pw201
Embedded in Academia : A Quiz About Integers in C
"The C language's rules for integer operations have some quirks that can make even small programs behave in confusing ways. This post is a review of these rules in the form of a quiz containing 20 questions." I did OK except on the ones about shifts.
arithmetic  integer  C  programming 
june 2012 by pw201
Embedded in Academia : Nine ways to break your systems code using volatile
"The volatile qualifier in C/C++ is a little bit like the C preprocessor: an ugly, blunt tool that is easy to misuse but that — in a very narrow set of circumstances — gets the job done. This article will first briefly explain volatile and its history and then, through a series of examples about how not to use it, explain how to most effectively create correct systems software using volatile. Although this article focuses on C, almost everything in it also applies to C++." Relevant to my interests as compilers get cleverer about re-ordering.
volatile  embedded  programming  C  threads  multicore  memory-model 
november 2011 by pw201
A Few Billion Lines of Code Later: Using Static Analysis to Find Bugs in the Real World | February 2010 | Communications of the ACM
Bunch of academics write a static checker and take it commercial. They are surprised to find that: Compilers for embedded targets accept stuff which isn't quite C, embedded programmers use the stuff, because we're evil. A worryingly large proportion of programmers are clueless ("No, ANSI lets you write 1 past the end of the array"), concluding that "You cannot often argue with people who are sufficiently confused about technical matters; they think you are the one who doesn't get it. They also tend to get emotional. Arguing reliably kills sales." Also, managers like graphs of bad stuff to go down over time, so don't like the tool to improve. Fun article. Via Metafilter.
programming  analysis  security  software  coverity  development  tools  C 
february 2010 by pw201
The C Programming Language: 4.10 by Brian W Kernighan & Dennis M Ritchie & HP Lovecraft
"C functions may be used recursively; that is, a function may call itself either directly or indirectly. Uninquiring souls may take this as just another peculiarity of those C folk, of whose ways their neighbours speak little to outsiders but much among themselves.

Keener news-followers, however, wondered at the events of the winter of 1927-28, the abnormally large number of calls placed upon the stack, the swiftness with which that list was sorted, the disturbing lack of heap allocation throughout the proceedings, and the secrecy surrounding the affair."
funny  humour  parody  C  programming  lovecraft  horror 
december 2009 by pw201

Copy this bookmark: