America Online APPLE II DEVELOPMENT FORUM CONFERENCE LOG Tuesday, August 7, 1990 10:00 p.m. eastern time Topic: Pascal and C Programming Forum Leader: Dave Sugar (AFL Dyfet) AFL Dyfet Tonight is Pascal and C :) AFL Dyfet On time and on target :) PeterK75 Is this the Pascal/C chat? AFA Gary J Yes! PeterK75 Will you be doing anything with //e & c? AFL Dyfet Well, we could, though there aren't very many products for 8 bit machines AFL Dyfet unfortunately. PeterK75 I know. I've been looking. I was hoping to find something here. AFA Gary J There are (were?) a couple of C products for 8 bit machines... (trying to find AFA Gary J my info) AFL Dyfet There was Hyper C... AFA Gary J Ah, found it. AFA Gary J (I always refer to this particular issue of "Open-Apple" on this.... August AFA Gary J 1988) GS Geek manx, aztec... AFA Gary J Yes. PeterK75 I've heard of Aztec C for Mac... AFA Gary J There's Aztec C (3 versions) from Manx Software Systems AFA Gary J Manx Software address is: AFA Gary J 1 Industrial Way AFA Gary J EatonTown, NJ 07724 AFA Gary J (201) 542-2121 PeterK75 I'll keep it in mind. Thanks!!! :) AFA Gary J I don't know if they're still around or not. PeterK75 They've still got the Mac version...only one way to find out! KevinMax Do you have to have ORCA/M to use ORCA/C? (or is ORCA/C standalone?) AFA Gary J ORCA/C is stand alone. AFA Gary J It comes with the ORCA shell and desktop environment. KevinMax Well then what is ORAC/M? AFA Gary J ORCA/M is an assembler. AFA Gary J (For Assembly Language :) AFA Gary J It also comes with the shell. KevinMax ahhh...Thanks AFA Gary J (but doesn't come with the desktop programming environment) GS Geek its also macro spelled backwards, like yzzo is ozzy backwards. PeterK75 Ahhh...thanks. AFA Gary J ...or keeg is geek spelled backward KevinMax or sdrawkcab is backwards spelled backwards! :) AFA Gary J (took you a while to type that one out, didn't it :) PeterK75 We could go on forever... AFA Gary J ...but we only have an hour. KevinMax hehe :) Matt DTS What's hcsneM spelled backwards? AFA Gary J Mensch!! Matt DTS .thgiR PeterK75 Well, C is C spelled backwards. :) AFA Gary J Wow. We should write a computer program to handle these difficult tasks. AFA Gary J (Let's write it in C) AFL Dyfet And my sgII elppa :) KevinMax lacsaPPascal GS Geek that was in my final a few days ago, not again... AFL Dyfet There is a filter in unix just for that Gary.... KevinMax I hate Pascal!! AFL Dyfet And a C func. in ANSI C :)...Somebody thought ahead on that :) PeterK75 Oh, joy. GS Geek is it Reverse -u <>? GS Geek no, its not. GS Geek thanks. AFL Dyfet I think it's just 'rev'...they tend to be terse in unix :) AFA Gary J How many people here own ORCA/C? (and how many have received their 1.1 update?) KevinMax Want to soon!!! PeterK75 Nope. No GS. AFL Scott <---Via Email. Matt DTS I have (both) KevinMax get orca/c that is. AFA Gary J I got my 1.1 update with my Design Master shipment. AFL Dyfet Haven't received update yet :( Matt DTS I got mine in Kansas. AFL Dyfet Have 1.1 b11 still... HeadCase Got mine at the Dev Conf AFA Gary J (Kansas - THE place to get your ORCA/C update, among other things :) AFL Dyfet (Among other nifties :) AFA Gary J :) AFA Gary J Speaking of nifties, where's Dave "DA's are my life" Lyons? AFL Dyfet I think he's being kept in a dark cave again :) A2Evanglst Mr Tangent isn't here :( AFA Gary J (Hopefully turning out impovements to Big Brother :) HeadCase He's working on NL5.0!!:) AFL Dyfet Now, tonight's topic is Pascal and C, and I was wondering who here would wish AFL Dyfet to comment on their experiance with the Orca/C 1.1 update... AFL Dyfet I see Nifty List Lyons has arrived :) AFA Gary J Ahh... there's Dave now. Dave Lyons (I'm late!) AFA Gary J (we know!) KevinMax His ears must have been burning AFA Gary J :) Dave Lyons I've been putting "sessions" into Nifty List so you can be in it more than once at a time. Dave Lyons (This is only an exhibition, not a competition, so PLEASE, no wagering....) AFA Gary J C seems to be where it's at, in programming with high level languages. I AFA Gary J haven't used C on any machine other than the IIGS. Is the IIGS C up to par AFA Gary J with what's available in the rest of the computer world? KevinMax Good Question!! AFL Dyfet Apple has taken a different approach. They are very big on Pascal and object AFL Dyfet oriented programming. As to Orca/C's ratings, with release 1.1, I would say it AFL Dyfet is as capable as any standard compiler I have seen. It compares well with the AFL Dyfet features of MicroSloth C 5.1 and Quick/C, especially with the addition of the AFL Dyfet mini assembler and missing library routines for unix I/O. And I suspect may AFL Dyfet prove to have fewer bugs :)... AFA Gary J (You mean machines other than the IIGS have software with bugs??) AFA Gary J :) AFL Dyfet Yes, Gary :) AFL Dyfet Look at MS-DOS itself :) AFA Gary J :) KevinMax yeah one big bug!! AFA Gary J Yep. (I'm plagued with it's stupid bugs every day!) AFA Gary J So, the IIGS has pretty much state-of-the-art in the C compiler it has AFA Gary J available, then. AFL Dyfet Well, suitible for solid work...state of the art gets esoteric, and many AFL Dyfet compilers are now comming C++... AFA Gary J (THE C compiler it has available.... does anyone consider APW C anymore?) KevinMax how true to ansi is orca/c? AFL Dyfet GA Scott AFL Scott The only real incompatibilities in Orca/C 1.1 stem from the GS. The big one that I've found is AFL Scott \p option. AFL Scott However, there are still things that are up to the author of compilers for ANSI C to interpret. Mike AFL Scott has done a good job. AFL Dyfet This is also a result of APW C compatibility, if I recall... AFL Dyfet I agree with Scott there... KevinMax ok thanks! AFL Scott Side comment? AFL Scott I happen to agree totally with statements made in the Byte Works IC area with regard to the illusion AFL Scott of C portability. There are more C programs out there in the world that aren't portable. Authors AFL Scott have to be really careful when portability is desired. A big snafu on APW and Orca is the AFL Scott handling of stdin, out, and error. One must remember at all times that the toolbox is used AFL Scott to handle redirection so you must make sure that your standard input is compatible with the way AFL Scott the GS handles it. It is WAY different from unix. AFL Dyfet C only, at best, addresses portability at the level of basic text mode/printing AFL Dyfet applications, and then often fails there :)...While ANSI standard libraries AFL Dyfet have made it possible to trust basic file access when porting, this still AFL Dyfet leaves a LOT of untouched ground. GUI's have created a whole new dimension to AFL Dyfet the problem of porting. Programming on the IIgs is NOTHING like programming AFL Dyfet under Windows which is NOTHING like programming under Motif/Open Look, etc. AFA Gary J How big of a problem is porting C to/from the Mac? AFA Gary J (from the IIGS, of course) AFL Dyfet The Mac is at least conceptially similar; tools for window management/drawing, AFL Dyfet event based programming, etc... AFL Dyfet GA Scott AFL Scott That depends on what you're porting and the implementation of C on the mac you're using. For AFL Scott instance, MPW C uses 32 bit integers (good, IMHO), and THINK C uses 16 bit integers. Think C would AFL Scott probably be more portable to the GS for that fact alone. However, THINK C uses a non standard way AFL Scott of handling headers. The guys from Apple can better address this, though, I think. I've only AFL Scott tried two programs from the Mac and have had a fair amount of difficulty. AFL Dyfet GA Dave... Dave Lyons I'm not up on Mac Cs, but I can offer this: if you're trying to write something portable, be sure Dave Lyons to use #defines for your types...like Word for int, so you can re-#define it as short if you need to, Dave Lyons etc. The GS interface file type.h does this, and I think it gets used everywhere. I don't think it's Dave Lyons actually an issue with the available C compilers for the GS, but I could be wrong. ga AFA Gary J Anyone know anthing about LightSpeed C for the Mac? How portable would it AFA Gary J be with ORCA/C? Matt DTS LightSpeed C = Think C AFA Gary J Oh, didn't realise that :) Matt DTS (in the same way AppleLink Personal Edition = America Online) AFA Gary J I C. Thanks. AFL Dyfet GA Scott AFL Scott I'd like to see Mike really run with the desktop interface for ORCA/C. My comment about THINK C's ... AFL Scott Non-standard header inclusion method (for lack of a better phrase) is very easy to use, it would be AFL Scott great if Mike could get the very serious bugs out of ORCA/DeskTop and move in the direction of a AFL Scott Think C like interface... it's very, very nice, IMHO. AFL Dyfet Okay, any more comments on C porting?? AFA Gary J I suppose the best approach (if you wanted to write for both the Mac and IIGS) AFA Gary J would be to use MPW C? AFL Dyfet GA Dave... Dave Lyons MPW C is ANSI these days, I think, but MPW IIgs C isn't (it's like APW C, only the same). Dave Lyons C.K. Haun is our local resident parallel-development Dave Lyons expert, and we have some material out on the developer CD for helping Dave Lyons with parallel Mac/GS development, with I assume more to come. ga AFL Dyfet GA Scott AFL Scott Just a quickie to say that I really liked this issue of Develop! So much for the GS in there, and AFL Scott Jim Merritt addressing the issue of parallel-development was great! done. Matt DTS Uh...Jim Merritt talked about parallel development in "Apple Direct". CD-ROM was the subject of Matt DTS develop #3. AFL Scott Sorry... I'm tired, Matt... I made a mistake. Matt DTS No excse, Scott. Go directly to jail. Do not pass bank zero, do not collect Nifty List 3.1. AFA Gary J Matt :) Dave Lyons (Do not collect 512. :-) AFA Gary J I'm out of C questions for tonight :) (My mind needs to return to assembly :) AFL Dyfet Assembly...thats another night Gary :) AFA Gary J Well, C was written in assembly, wasn't it???? :) KenSp how formal are these chats? There is something I need to know,but KenSp its pretty basic stuff. AFL Dyfet That's okay Ken...Feel free to ask your question... KenSp well, I'm working on a junior high math package, and we ran across an KenSp interesting bug in Apple mathematics. Matt DTS Meaning AppleSoft, correct? KenSp It seems that the number 5.892 is interpreted as 5.892001 Matt DTS That sounds like an Applesoft bug to me. KenSp I want to write a small program to find other 4 digit numbers between KenSp -9999 and 9999 that will act similarly strange so I can trap them. AFA Gary J In what language, Ken? KenSp In Pascal or Basic KenSp I started, but it isn't working Matt DTS You don't necessarily have to trap for them - you can programmatically stomp them on the fly. Dave Lyons Ken, lots of Real numbers cannot be represented Dave Lyons precisely in a finite number of bits in binary. You -will- get the sort of problems you've Dave Lyons found, and you pretty much have to do some rounding-off to avoid problems. Instead of Dave Lyons checking for equality, for example, check for ABS(X-Y) < 0.000001 or something. Dave Lyons (Err...too many 0s in my example.) A2GS Would subtracting 1 and then readding 1 to one of those strange REAL numbers A2GS help? KenSp anyone care to try to explain why that happens? A2GS Because Apple's are wierd. KenSp yes, but there is also a logical explanation, isn't there? AFA Gary J It does seem strange, since hand held calculators use the same types of AFA Gary J functions, and they get accurate results. A2GS It's based on the way Applesoft represents REAL numbers. AFL Dyfet I have seen strange FP rounding errors on many machines... Dave Lyons Not just Apples or Applesoft. Any representation of real numbers is weird. Dave Lyons Calculators don't always get accurate results, either. Dave Lyons I believe Applesoft does -not- always do as good a job as possible of representing certain numbers Dave Lyons in the number of bits available, *but* you still would have problems anyway. For example, Dave Lyons (1/3*3)-1 would not be exactly zero, I think. Dave Lyons (HP calculators use BCD...they actually represent each digit separately, instead of using a more Dave Lyons compact binary format. That means they can represent numbers exactly as you type them in, but Dave Lyons you still have round-off problems once you do operations on them.) A2GS You can see something strange happen, if you start incrementing a variable A2GS which started at 0, I think when it reaches 6 it will now have the new value of A2GS 6.000001 (or whatever) Dave Lyons A2GS, I don't think that happens for any reasonably small numbers...can try it, though. Dave Lyons I'm up to 2000 still, with out strangeness. KenSp when, at the basic prompt, you type x=5.892 then you press return and KenSp type Print x and you get 5.89200001 KenSp that doesn't make much sense A2GS I once did this thing years ago and for some reason (if I remember correctly) A2GS this strange representaion bug consistantly showed up. Dave Lyons For that matter, type PRINT 5.892 and you'll get 5.89200001. A2GS I wrote the program on an Apple II (original), have one of those handy? Dave Lyons The Applesoft floating point routines have not changed, as far as I know. I just tried this Dave Lyons stuff on my GS, and it works as described (including PRINT 5.892 --> 5.89200001). AFL Dyfet A lost bit in there, no doubt :) A2GS Well, I don't know, should I ever come across the bug again, I will formely A2GS submit my bug discovery to Sculley on a silver platter. AFA Gary J Probably should be submitted to Steve Wozniak :) A2GS (not that I expect anything to be done with it once he gets it) AFA Gary J (It's been around that long) AFL Dyfet Microsoft did Applesoft... AFL Dyfet Steve did Integer, which works fine :) AFA Gary J That's true Dave Lyons I'm not even sure it's a bug...you just can't represent most decimal numbers exactly, and Dave Lyons Applesoft doesn't do the sort of rounding off that calculators usually do to hide the Dave Lyons slight inaccuracies.