Wednesday, December 03, 2014

printf and size_t from clang using %zu

C99 added the printf format specifiers %zu, %zx, etc. for printing something of the type size_t.

This worked fine on my Macintosh last night running Mac OS X 10.10 (Yosemite).

However, on my Windows machine at work using clang 3.6.0, it just printed zu or zx. That is, until I realized that I needed to add -std=c99 to my command line. Then, it recognized %zu and %zx correctly.

Tuesday, July 22, 2014

Python for .NET "import" fails

If you're using Python for .NET, and you have the following Python code:
import clr
import MyNETNamespace
and you get the error message:
ImportError: No module named MyNETNamespace
You should try two things:
  1. Make sure your .dll is named "MyNETNamespace.dll"
  2. Make sure all the .dll's that MyNETNamespace.dll is dependent on are in the directory, too. 

Sunday, February 16, 2014

A quote about design

Designers notice the gap between functional and delightful, and that’s why we obsess over the little details.

Source: http://www.gv.com/lib/design-details
 That's how I feel about software APIs.

Saturday, January 11, 2014

Clang can't find stdio.h, etc

I decided to play with Clang on Windows this morning, using the pre-compiled binaries. However, when I try to compile a hello world app, I get this error message:

fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^
1 error generated.


Googling didn't help me figure out where to get the standard library for c. But, when I did clang --verbose hello.c, I got a hint:

...
ignoring nonexistent directory "c:/mingw/include"

...

So, I installed MinGW (and its mingw32-base and mingw32-gcc-g++ packages).  Now, I have that directory, and have a standard library for C that Clang can use, along with a ton of useful utilities.  I then added the C:\MinGW\bin directory to my path.