April 30, 2012

C library

If you don't own a copy of the C library book, there's c standard library site which is not detailed as the book but it's online. Not only declarations but also definition are provided.

C standard library [clc-wiki.net]
It has section with solutions for K&R2 book.

The Open Group Base Specifications [pubs.opengroup.org]
The official definition of a UNIX system. Functions are indexed and quickly retrieved. I use it from time to time as a reference.

Bitfields C - strength and weakness

Bitfields are powerful and widely used (mostly in embedded) although they introduce some limitations.

  • You can't apply address operator to bitfield because they operate on bits not bytes. 
  • They are always converted to the int type for computation.
  • If you use signed int, be aware of the range of values for the defined type. Signed int a:1 has a value 0 or -1 not 1 !
  • C language gives no guarantee of the ordering of fields within machine words. The packing order are implementation defined.

More reading about this topic in following sites:

Understanding bit fields c [linuxforu.com]

C bitfields [cs.cf.ac.uk/Dave]

Working with bits and bitfields [coranac.com]

Bitfields Endianness [mjfrazer.org/mjfrazer]

Bitfields Aligment [keil.com/support]

April 24, 2012

Get ready for an interview

I bet everybody out there went at least once to the interview. There are many sites which could help you with preparation and even though I haven't went to any at least few months, i check some questions sometimes only for fun and to improve the creativity and expand the knowledge.

C programming questions and answers [indiabix.com]

0x10 best interview questions [rmbconsulting.us]
I consider this as a classic in my eyes. I remember i run into the 0x10 list when i was not able to answer few of those if not all :)

Glass Door [glassdoor.com]
This one is a bit different, it contains information about the salaries, job interview questions for an exact position. Worth to register and check it out!

I'll expand this list by time.

Algorithms with bits

 I was playing with code for a decoder today and had to find an algorithm to calculate all bits set in the short integer and find also first bit set (lowest) and last bit set (highest). Certainly simple task with these sites to start with.

Bit Twiddling Hacks [graphics.stanford.edu]
 There are posted many different algorithms which you can choose which suits you.

Aggregate Magic Algorithms [aggregate.org/MAGIC/]
Less, but also useful.

KEIL - Counting set bits in byte [keil.com/support]
Nothing new to mention but it's short in context.

More sources [aggregate.org/MAGIC]
More links for reading found on aggregate magic algorithms.

April 15, 2012

Properties of the compiler and floating point arithmetic test

While i was reading The C library book, i come across two tests which are mentioned in the float chapter.

Enquire tests the properties of a compiler and the machine which is run on. It creates the file with the outputs.

Enquire test written by Steven Pemberton of CWI
More reading at: Enquire details

Paranoia tests the floating point arithmetic used.
Paranoia W.M. Kahan

April 13, 2012

C language books

I've purchased books quite regular since last year.

I include a list of C language book recommendations, I haven't read them all so far, I intend to. I grabbed C puzzle book last weekend and had fun with some exercises which seem to be easy but tricky sometimes. My all-time favorite is K&R which helped me quite a lot.

C language book recommendation

ARM Information center (bookmark)

Everybody who ever have worked with ARM should be familiar with ARM information center. For those who don't, it is informative reference which might help even if you work with different architecture or in the embedded area.

ARM infocenter

April 6, 2012

DSP Filters for touch sensing (bookmark)

I had to correct one IIR filter in touch sensing software because there was potentially one overflow in computing. This pdf from microchip contains few filters with C codes and figures how they affect the signal.
Various filters for touch sensing signals

Various coding standards (bookmark)

I visit CERT C secure coding standard from time to time to check for some complementary solutions.
C secure coding standard

Left hand comparison was brought up during the discussion, here's adaptation from NetBSD coding style page:
C coding standart [users.ece.cmu.edu/~eno]

Google chromium coding style [dev.chromium.org]
This particular was mainly because I was looking for something regarding C++, like macro DISALLOW_COPY_AND_ASSIGN, very informative webpage for developers !

C language pitfalls (bookmark)

Do you know the answer for a following declaration : (*(void(*)())0)()?

C language quirks, few examples which might catch your attention:
C language quirks
C pitfalls book available online:
C Language Traps

Linker command file (bookmark)

I run into a problem with linker command file where was KEEP_SECTIONS defined. I include some links with this topic to get familiar with linkers.

Linker command file (gnu) [delorie.com/gnu/docs/binutils]

Commands and Operators in Linker files

Linker description and an example - Chapter 7 [csapp.cs.cmu.edu]

Linkers and Loaders book
Linker and Loaders book written by John R. Levine published online.

Beginner's guide to Linkers [www.lurklurk.org]
Beginners guide to Linkers is explanatory article about process of linking. It has introduction to C++ and how linkers are changed because of new features of C++ compare to C language.

Linker Script File [bravegnu.org]
The article explains linker script file and in a next chapter how data are placed in RAM.

Preprocessor C/C++ (bookmark)

Preprocessor can be sometimes useful with directives, constants, and macros.

Difference between preprocessor [c-links.blogspot.com]
Description of preprocessor, assembler, linker

The Preprocessor for GCC [www.cs.utah.edu/dept]
Well written guide with many examples.

C preprocessor Tricks [cprogramming.com/tutorial]
C programming tricks with preprocessor.