delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/30/12:03:47

From: mlsmith AT ktis DOT net (Michael L. Smith)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Announcement: OmniBasic Version 1.27
Date: Fri, 29 Aug 1997 15:48:04 GMT
Organization: Computer Design Lab
Lines: 36
Message-ID: <5u6qvk$tg_002@mlsmith.ktis.net>
References: <5so1im$s0_006 AT mlsmith DOT ktis DOT net> <5tdvas$o4_008 AT mlsmith DOT ktis DOT net> <340506ED DOT 6047 AT ktis DOT net> <5u5t3d$7pk AT freenet-news DOT carleton DOT ca>
NNTP-Posting-Host: news.newsdawg.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <5u5t3d$7pk AT freenet-news DOT carleton DOT ca>, ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) wrote:
>
>"Michael L. Smith" (mlsmith AT ktis DOT net) writes:
>> C Version:
>> 
>> int i;
>> int x;
>> 
>> main()
>> {
>> for(i=1; i<1000000000; i++) x=i;
>> }
>> 
>> Basic Version: (identical version used for both OmniBasic and Power
>> Basic)
>> 
>>  dim i as long
>>  dim x as long
>> 
>>  for i=1 to 1000000000
>>         x=i
>>  next i
>
>
>Sounds like a brain-damaged BASIC to me. It turns a loop meant to go from
>1 to 1000000000 into a loop that goes from 1 to 999999999! :-)

You have no way to know that! (AND it is not true!). What this does point out 
is that the C version does only count to 999999999. My mistake. The C version 
should be: for (i=1;i<1000000001;i++) x=1;

Pehaps you were thinking that the C code shown is what is produced by Omni. 
Not so.The C code produced by Omni was not given in the example at all.

-Mike
>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019