Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!dayton!viper!john From: john@viper.UUCP Newsgroups: comp.sys.atari.st Subject: Re: "file selector" blues, Megamax bug Message-ID: <821@viper.UUCP> Date: Sun, 12-Apr-87 16:14:55 EST Article-I.D.: viper.821 Posted: Sun Apr 12 16:14:55 1987 Date-Received: Tue, 14-Apr-87 00:14:38 EST References: <639@batcomputer.tn.cornell.edu> Reply-To: john@viper.UUCP (John Stanley) Organization: DynaSoft Systems Lines: 39 Keywords: user-friendly C sizeof In article <639@batcomputer.tn.cornell.edu> braner@tcgould.tn.cornell.edu.UUCP (braner) writes: > >Programmers: please take more care to change the defaults passed to > that dialog box as appropriate, and to accomodate users that > use the ST in a different fashion than you: RAMdisk, hard disk, > color, B&W, etc. > This is true of a lot of programs. There are too many people not allowing for disk systems, hardware, or patterns of use different from what they would normaly use. I try to avoid making those types of mistake by showing my programs to others before I release them. If possible, I'd recommend you folkd try doing this to. It's never too late to rethink your interface or the methods that lie behind them... >Yet another bug in Megamax C: > > sizeof("a string constant") always yields 4. > > (sizeof(s) where s is of type array-of-char works fine.) > >- Moshe Braner As I mentioned before... This is infact the right way for sizeof to work. When you ask for sizeof(something) you're always asking how large that element is to the compiler. The type reference is a reference to a type with a specific size... The reference to the string is translated into a pointer before sizeof gets around to doing it's job. I agree that the latter is confusing, but it conforms to K&R page 94 "... a reference to an array is converted by the compiler to a pointer to the beginning of the array." And to page 188 where the effects of using sizeof on a type identifier is described. If you wanted to know how long the string is, you might want to use strlen instead... --- John Stanley (john@viper.UUCP) Software Consultant - DynaSoft Systems UUCP: ...{amdahl,ihnp4,rutgers}!{meccts,dayton}!viper!john