Path: utzoo!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!wuarchive!kuhub.cc.ukans.edu!markv From: markv@kuhub.cc.ukans.edu Newsgroups: comp.sys.amiga.programmer Subject: Re: Help this neophyte... Message-ID: <29019.27db6ecc@kuhub.cc.ukans.edu> Date: 11 Mar 91 17:49:32 GMT References: <27282@uflorida.cis.ufl.EDU> Followup-To: comp.sys.amiga.programmer Organization: University of Kansas Academic Computing Services Lines: 64 In article <27282@uflorida.cis.ufl.EDU>, barbecue@pine.circa.ufl.edu (MERCER) writes: > Assuming this post gets through, I am looking for some help > with my novice attempts to program in C on my Amiga 500. > I am just beginning to learn C, and I am using Aztec C 3.6a. > (Yes, I know I need to upgrade...) > My first question is this: when I attempted to write a simple > program to do some string manipulations, I encountered a bug| > feature|pecadillo of my compiler with regard to the index(), > rindex(), strchr() and strrchr() functions. It seems that these > functions are returning integers, when the documentation says > they should return char pointers. You are probably calling the functions without declarations. In C if a function isn't declared it defaults to returning an int. With Manx 3.6a try including or (not sure of 3.6 include scheme). You need the declarations like this: char *strrchr(); Which says strrchr() returns a char pointer. Without this line the compiler assumes an int. Actually, if an int is the same size as the pointer (32 bit ints), then the code will still work despite the compiler warnings (in the case of the Amiga at least). > I have looked in all my reference > materials, and tried C on other systems, and these functions work > as advertised. Why is Manx returning these integers? I even tried > using the integers in several ways, but had little luck. Manx 3.6 defaults to 16 bit ints. You can use 32 bit ints, which I would advise, esp. since a lot of PD unix code (older stuff) indiscriminately uses ints to store and manipulate pointers. Just use the correct compiler switches and the 32 bit libraries. > Given that I probably won't be getting a 3000 anytime soon, which > compiler is best for me? How ANSI compliant/compatible are they? > How much do they cost? And can anyone suggest ftp sites, specific > fish disks, or other specific sources of programming aids and utils > (things like a make program, a lint, a debugger, and in particular, > text files which list or describe bugs, problems, idiosyncrasies, > and non-portabilities of Manx C? If money is an issue, I would strongly advise trying a PD/Shareware compiler like DICE (or Gcc if you have LOTS of RAM). These compilers are more "modern" than Manx 3.6 and support things like function prototypes that solve a lot of problems like this. > I am grateful in advance. > Email repsonses are preferred, cash donations gleefully accepted. > > BARBECUE@pine.circa.ufl.edu - Internet > BARBECUE@UFPINE - BITNET > Barbecue@ribs.grill.patio.backyard - Foodnet -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark Gooderum Only... \ Good Cheer !!! Academic Computing Services /// \___________________________ University of Kansas /// /| __ _ Bix: mgooderum \\\ /// /__| |\/| | | _ /_\ makes it Bitnet: MARKV@UKANVAX \/\/ / | | | | |__| / \ possible... Internet: markv@kuhub.cc.ukans.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~