[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130811000749.GV221@brightrain.aerifal.cx>
Date: Sat, 10 Aug 2013 20:07:49 -0400
From: Rich Felker <dalias@...ifal.cx>
To: discussions@...sword-hashing.net
Subject: Re: [PHC] C99 in reference implementations
On Sat, Aug 10, 2013 at 04:18:19PM -0700, Dennis E. Hamilton wrote:
> <stdint.h> is implemented in Visual Studio 2010. (There is also
> <cstdint>) as a counterpart in C++ which uses a proper namespace,
> etc.)
>
> For older versions of Microsoft Visual Studio, you can find
> third-party versions on google code, github, and elsewhere. Just
> search for "stdint.h visual studio".
>
> My recommendation would be to use Clean C (C Language that is C++
> compatible) and also limit the solution to the free-standing subset
I would strongly disagree with calling this "clean C". The language
which is the intersection of C and C++ is very ugly; in particular, it
forces you to use casts which are anti-idiomatic in C and hide bugs or
result in difficult to maintain code. The best example of casting the
result of malloc, which is against best practices of:
T *p = malloc(sizeof *p); // OR
T *p = calloc(sizeof *p, n);
C and C++ are very different language, both in terms of subtle
semantic differences and extreme differences in which idioms
constitute best practices versus bad coding. Compiling C code as if it
were C++ is inviting bugs, and serves no purpose, since well-factored
C code for use in C++ projects can simply be kept in separate C source
files or libraries.
Rich
Powered by blists - more mailing lists