From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] new compilers Date: Thu, 30 Mar 2006 19:27:32 +0100 From: rog@vitanuova.com In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 27c17cde-ead1-11e9-9d60-3106f5b1d025 i said: > no typechecking. and this is the part that really bugs me. endless use of void*; if you get it wrong, who knows what'll happen. the compiler certainly can't help. under the interfaces i was looking at in macos x, most things are accessed through a trio of calls along the lines of: find out the size of data stored for a property: OSStatus AudioHardwareGetPropertyInfo(AudioHardwarePropertyID inPropertyID, UInt32 *outSize, Boolean *outWritable); get the data for a property: OSStatus AudioHardwareGetProperty(AudioHardwarePropertyID inPropertyID, UInt32 *ioPropertyDataSize, void *outPropertyData); set the data for a property: OSStatus AudioHardwareSetProperty(AudioHardwarePropertyID inPropertyID, UInt32 inPropertyDataSize, void *inPropertyData); where a tag might be, for example, kAudioUnitProperty_SetRenderCallback. IMHO this is the logical extension of the ioctl-is-comfortable school of programming. there are thousands of property tags, each with their own argument type (often undocumented) and implied semantics (often under-documented). it's incredibly clunky and error-prone to program, and i'd imagine it's a nightmare to maintain. a piece of code that, if the interface was right, could be just one element of an expression, takes about 7 lines of brittle code sorry about the off-topic rant, but perhaps it's useful to compare the two approaches.