Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!tektronix!nosun!tessi!joey From: joey@tessi.UUCP (Joe Pruett) Newsgroups: comp.unix.wizards Subject: Re: of course! Message-ID: <563@balthmus.tessi.UUCP> Date: 8 Dec 89 01:09:31 GMT References: <152@norsat.UUCP> <2586@unisoft.UUCP> <15769@bloom-beacon.MIT.EDU> <17264@rpp386.cactus.org> <4526@ski.cs.vu.nl> <17303@rpp386.cactus.org> <1051@root44.co.uk> <1989Nov22.224209.28911@athena.mit.edu> <128791@sun.Eng.Sun.COM> Reply-To: joey@tessi.UUCP (Joe Pruett) Organization: TSSI, Beaverton, Oregon Lines: 23 I know this is a GNU-ism, but local variable sized arrays seem like the best of all worlds. For example: isadir(path) char *path; { char tpath[strlen(path) + 3]; strcpy(tpath, path); strcat(tpath, "/."); . . . } It is fairly quick, only uses as much memory as is necessary, and the storage automatically goes away at the end of the function. This is one of the best additions to C that I've seen. It's intuitive, let's the compiler do the yucky work (alloca is a hack), and add's a very useful feature. Yes, 3 should be calculated instead of a constant, but I gotta have something for people to complain about... :-)