www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/27/00:44:47

From: David Jenkins <me AT jenkinsdavid DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: register int variable Is there any point???
Date: Thu, 27 Feb 1997 02:56:07 +0000
Organization: None
Distribution: world
Message-ID: <jXNX8DAHfPFzEwJ0@jenkinsdavid.demon.co.uk>
References: <ws6jCCAYMEFzEwZ0 AT jenkinsdavid DOT demon DOT co DOT uk>
NNTP-Posting-Host: jenkinsdavid.demon.co.uk
MIME-Version: 1.0
Lines: 27
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <ws6jCCAYMEFzEwZ0 AT jenkinsdavid DOT demon DOT co DOT uk>, David Jenkins
<me AT jenkinsdavid DOT demon DOT co DOT uk> writes
>
>So why doesn't DJGPP let me change an int variable to a register int
>variable??
>
Yes I was using the "d" variable as a global.This is were I was going
wrong.
I've been working through a tutorial using what programing knowledge I
have from my basic days and applying them to a simple demo type program
I'm using to apply newfound knowledge.
Since I'm used to using globals most of the time in basic,I've been
finding it hard to convert to the C methods.Which I now understand a
little better.

I used a simple
rawclock()-timebefore_loop_was_started
for timing a heavy loop using normal int variable in for(d=1 to 1000)
and again using a register int in for(d=1 to 1000) the resulting time
difference was almost unnoticable.
Is there any point in using a register int in a for loop???
Or am I using a timing method which is incorrect??

-- 

David Jenkins

- Raw text -


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