From: Greg Long (cc65_at_maneuveringspeed.com)
Date: 2003-03-04 08:23:44
Thank you, I don't mean to make this a tutorial or support-line thread, but I'm bound to have a few other questions. :) Programming the c64 is clearly quite a cult thing nowadays since its practicality is quite limited, but I think it's important we don't forget how. I have an immaculate 1982 c64 that I recently acquired which has almost no dust in the keyboard - I swear it was never used. I fired it up to run it, but don't routinely. In the 80's and early 90's without any formal training my programming was BASIC compiled with Blitz! and of course, Assembly code, I used Yves Han's Fast Assembler. I'm itching to write a game or something cool for the 64 just to say I still can. :) I will get a book on C. At OIT (www.oit.edu) we don't touch C, but live and breathe C++ in the Software Engineering program. Thanks, Greg Long former co-sysop Westwood BBS, Hillsboro OR, 1985-1988 -----Original Message----- From: owner-cc65_at_musoftware.de [mailto:owner-cc65_at_musoftware.de] On Behalf Of Marko Mäkelä Sent: Monday, March 03, 2003 11:07 PM To: cc65_at_musoftware.de Subject: Re: [cc65] malloc and Sort.c(26): Error: Expression expected On Mon, Mar 03, 2003 at 10:46:20PM -0800, Greg Long wrote: > Is there an unusual syntax for malloc? I notice it doesn't like to > take anything but a constant. It's a good idea to produce a minimal input file that triggers the error. In this case, I'd suspect two other errors in your code: > unsigned int* ra; //declare array > ra = (unsigned int*) malloc(sizeof(unsigned int[size] )); > > unsigned int i = size;//line 20 The string "//" might not be a comment delimiter in the dialect of C that cc65 supports. Use /* */ comments instead. Also, you can't declare variables except in the beginning of a block. Swap the lines starting with "ra" and "unsigned int i", and it should work. I'd rather write the four above lines like this: unsigned int i = size; unsigned int* ra = malloc (size * sizeof *ra); Disclaimer: I haven't used cc65 yet, only other C compilers. Marko ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail. ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-03-04 08:25:00 CET