NSBlog
"A failure in the hot air department"
Showing entries tagged "c". Full blog index.
Friday Q&A 2017-08-11: Swift.Unmanaged
at 2017-08-11 13:14
In order to work with C APIs, we sometimes need to convert Swift object references to and from raw pointers. Swift's
Unmanaged
struct
is the standard API for handling this. Today, I'd like to talk about what it does and how to use it.Friday Q&A 2015-07-03: Address Sanitizer
at 2015-07-03 13:52
Outside of Swift 2 news, one of the exciting announcements to come out of WWDC was that clang's Address Sanitizer is now available directly in Xcode 7. Today I'm going to discuss what it is, how it works, and how to use it, a topic suggested by Konstantin Gonikman.
Friday Q&A 2015-03-20: Preprocessor Abuse and Optional Parentheses
at 2015-03-20 14:23
The other day I ran into an interesting problem: how can you write a C preprocessor macro that removes parentheses surrounding its argument, but leaves the argument alone if no parentheses are present? For today's article, I'm going to share my solution.
Friday Q&A 2013-08-02: Type-Safe Scalars with Single-Field Structs
at 2013-08-02 15:01
Welcome back, and apologies for going silent without warning. Something resembling normality has resumed, and so I hope to also resume something resembling my normal schedule. In any case, for today's article, local reader Michael Manesh suggested that I talk about how you can use (or abuse) C's type system to obtain stronger typing guarantees by creating
struct
s containing only a single field.Friday Q&A 2013-05-31: C Quiz
at 2013-05-31 13:46
I thought I'd mix things up a bit today and give my readers a quiz. The C language is perhaps the most popular computer language in existence, but it's also quite odd, and because of that often poorly understood. I'd like to give you a quiz to see how much you know about some of the odd but useful corners of the language.
Friday Q&A 2013-05-17: Let's Build stringWithFormat:
at 2013-05-17 14:40
Our long effort to rebuild Cocoa piece by piece continues. For today, reader Nate Heagy has suggested building
NSString
's stringWithFormat:
method.Friday Q&A 2013-05-03: Proper Use of Asserts
at 2013-05-03 13:03
Asserts are a powerful tool for building quality code, but they're often poorly understood. Today, I want to discuss the various options for writing asserts in Cocoa apps and the best ways to use them, a topic suggested by reader Ed Wynne.
Friday Q&A 2012-08-24: Things You Never Wanted To Know About C
at 2012-08-24 13:15
It's been a bit since I did an article, but I'm back again, with a somewhat off-the-cuff treatment of a very twisted set of code I use to pretend that C has exceptions. I delve into little-known extensions of C, Linux compatibility, and worst of all,
goto
, so be warned!Friday Q&A 2011-08-19: Namespaced Constants and Functions
at 2011-08-19 14:40
The inevitable rotation of the Earth means that it's once again time for another Friday Q&A. For today's edition, Jose Vazquez suggested that I discuss namespaced constants and functions in C.
Friday Q&A 2011-04-15: Compile-Time Tips and Tricks
at 2011-04-15 16:20
Greetings, salutations, and welcome to another edition of Friday Q&A, the Fridayest source of information on the internet. This week, friend of the blog Jose Vazquez had the idea of discussing miscellaneous compile-time tips and tricks in C/Objective-C, like useful preprocessor techniques and compile-time asserts.
Friday Q&A 2010-12-31: C Macro Tips and Tricks
at 2010-12-31 22:43
The year is almost over, but there's time for one last Friday Q&A before 2011 comes around. For today's post, fellow Amoeba Dan Wineman suggested that I discuss tricks for writing macros in C.
Friday Q&A 2009-08-21: Writing Vararg Macros and Functions
at 2009-08-21 15:15
Welcome to another Friday Q&A, where all references are strong and all values are above average. This week I'm going to talk about how to write macros and functions that take variable arguments in C, as suggested by Damien Sorresso.
Friday Q&A 2009-07-17: Format Strings Tips and Tricks
at 2009-07-17 15:21
Greetings and welcome back to Friday Q&A. This week I'm going to discuss some tips and tricks for using
printf
-style format strings in C, as suggested by Kevin Avila.Friday Q&A 2009-07-10: Type Specifiers in C, Part 3
at 2009-07-10 13:00
Here at last is the conclusion to Friday Q&A's three-part series on C type specifiers. The first week I discussed
const
and restrict
. Last week I discussed the basics of volatile
and why it's not very useful. This week I'm going to finish up by discussing the use of volatile
in a multithreaded context.Friday Q&A 2009-07-03: Type Specifiers in C, Part 2
at 2009-07-03 13:20
Welcome to another edition of Friday Q&A. Last week I began to talk about type qualifiers in C, and discussed the meaning and use of the
const
and restrict
qualifiers. This week I will continue with a discussion of the third qualifier, volatile
.Friday Q&A 2009-06-26: Type Qualifiers in C, Part 1
at 2009-06-26 16:11
Welcome back to another warm and fuzzy edition of Friday Q&A. This week I'm going to discuss the use of type qualifiers in C, a subject suggested by Nate Vander Wilt.
IOCCC 2006 Winners
at 2007-11-04 14:17
The winners of the 2006 IOCCC have been posted. Sadly I am not among the winners this year, but the winners all appear to be most deserving.
Hacking C++ From C at 2006-08-03 00:00
For a long time, LiveDictionary used deeply unwholesome methods to do its work. Version 1.2.5, just released, now uses nothing but public methods. This means vastly improved stability, but it also means that LiveDictionary's evil WebKit text grabber, once considered the app's crown jewels, is no longer useful. I'm going to use it as an object lesson on how to do evil things with C++ applications from pure C.
Score! at 2005-11-09 00:00
The International Obfuscated C Code Contest is a contest with the goal of creating the most unreadable, difficult-to-understand C program possible. Aside from being difficult to understand, the judges tend to prefer programs which do clever or interesting things, or which do mundane things in clever, interesting, or weird ways.