[ProgClub list] Memory management in C
asher.glynn at gmail.com
Sun Oct 2 04:28:06 AEDT 2011
> Never going to argue with that, unless they are doing Unix development. I
>> bite though - what _would_ you recommend?
> What would I recommend, for what? I guess I wouldn't argue with you or jedd
> that if you're going to be writing UNIX you're going to be wanting C!
> I'm fairly enamoured with C# on Mono. I think that's going to be my
> language/platform of choice. I say "going to be", because at the moment I'm
> pretty heavily involved with writing web apps in PHP. I'm happy writing web
> apps in PHP, by the way. Although it's all quite new to me, I'm enjoying the
> experience. PHP is a little brain-dead in parts, but it's functional. I have
> so much planned to do in PHP that I might not be finished for a few years.
> Unfortunately C# on Mono has a really sorry story for UI development in its
> buggy WinForms implementation. I think I'm going to stick with web-based UIs
> for the foreseeable future. I'd like to get back to writing web apps in C#
> (on Mono), but I'm a long way from there at the moment and there's no reason
> to believe I'll catch up any time soon.
> I think my current application is a great example of a system that
> *shouldn't* be written in C. I think if you're going to be doing the kind of
> "batch mode" "network sockets" "string processing" programming that I'm
> doing that you're better off picking a safer language. I guess python would
> be the typical recommendation, although there are others such as Thomas
> mentioned, e.g. OCaml.
Cool - was curious just to know what you were coding in. I think the wonder
of Unix is actually how little code you can get away with, using the right
set of tools, although the trend seems to be away from clever constructs and
to monolithic solutions (I blame Perl).
> Although, there is something mystical (and powerful) about it.
>> I think its aged remarkably well - what hasn't aged well is more the bits
>> the edge (APIs etc) and some of the assumptions about how it'd be used. It
>> dates back to a time where the competition was assembler, not high level
>> languages. Its also interesting to note the amount of C that isn't
>> in C as such - the compiler directives.
> Yeah, good point. I've always been a little intimidated by how much you
> need to know to compile a C program.
> Coming from a statically typed language like C# (or Java) into C is a scary
> journey. You lose all the safety that you've come to know and love, and this
> impacts heavily on the kind of design decisions you can make.
> I think the absolute failure of C is its approach to strings, it should
> have standardised a string structure that included the string length. And it
> probably should have done the same for arrays and included index bounds
> I think I'm probably going to implement a FuckedString structure for my
> strings in C like the one that Spolsky dumps on.
The real condemnation (for me) is around using libraries in C - even if you
are a good C developer, you'll get a hell of a shock when you go to look at
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the list