Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!mips!prls!pyramid!voder!apple!usc!samsung!uunet!snorkelwacker!mit-eddie!uw-beaver!rice!bcm!lib!thesis1.hsch.utexas.edu From: jmaynard@thesis1.hsch.utexas.edu (Jay Maynard) Newsgroups: comp.unix.questions Subject: Re: how to use scandir()? Message-ID: <4072@lib.tmc.ede> Date: 28 Aug 90 21:12:57 GMT References: <9008271747.AA02292@ws-38.cae.wisc.edu> <13677@smoke.BRL.MIL> Sender: usenet@lib.tmc.edu Organization: University of Texas Medical School at Houston Lines: 24 Nntp-Posting-Host: 129.106.7.3 In article katsu@sra.co.jp (WATANABE Katsuhiro) thinks all the world's a VAX: >>> n = scandir(".", namelist, NULL, NULL) is a reasonable call, In article <13677@smoke.BRL.MIL> gwyn@smoke.BRL.MIL (Doug Gwyn) corrects him: >No, it is not "reasonable". The only time you should pass uncast NULL >arguments to a function is when there is a prototype for the function >in scope, which is not possible in pre-ANSI C. In this particular case >the last two arguments should be either (int(*)())NULL or (int(*)())0. This bears repeating. Sloppy programmers get away with cruft like this on benevolent architectures like the VAX, where everything is 32 bits and may be freely interchanged; when this is tried on other machines, though, it blows up because suddenly the wrong amount of stuff is added to or removed from the stack. If you're trying to write portable programs, please don't assume anything is interchangeable with anything else! -- Jay Maynard, EMT-P, K5ZC, PP-ASEL | Never ascribe to malice that which can jmaynard@thesis1.hsch.utexas.edu | adequately be explained by stupidity. "It's a hardware bug!" "It's a +--------------------------------------- software bug!" "It's two...two...two bugs in one!" - _Engineer's Rap_