BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: Help - reference to global variables ?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ObjectPascal
View previous topic :: View next topic  
Author Message
baloonatic@hotmail.com
Guest





PostPosted: Wed Dec 10, 2003 8:48 pm    Post subject: Re: Help - reference to global variables ? Reply with quote



On 9 Dec 2003 13:59:03 -0800, [email]dunric (AT) centrum (DOT) cz[/email] (Dunric) wrote:

I've a feeling test.myinst would work but I have n't tried as my
fingers would go on strike.
Either of the following changes (or better both) would solve your
problem and make the code much more readable. This sort of practice
makes code maintenance and team developing extremely difficult, and I
would be very unhappy with any member of mine who came up with
something similar.

Consider yourself well smacked on the wrist. !!


Quote:
(Delphi object pascal - not VCL)
When names of variables or fields conflicts(are the same),
qualifiyng shall distinguish them.
But HOW TO QUALIFY them when they are not in a unit but IN MAIN
PROJECT FILE ?

sample code of Test.dpr:
-------------------------------------------------------
program test;
{$APPTYPE GUI}
uses Windows, Messages;


type
MyRecord = record
myInst: LongWord;
someOther: Boolean;
end;

var
// rename the variable so you can see it's the global one at a glance

say
globmyinst: longword // no need to quality it now.
Quote:
myInst: LongWord;
myRec: MyRecord;

...

begin
...
myInst := HInstance;
// damn with statements I hate 'em. so


myrec.myinst := myinst
//or even less confusing combine the two
myrec.myinst := globmyinst
myrec.somethother := false

Quote:
with myRec do
begin
myInst := {global_dpr_scope.}myInst; // !!!!!!!!!! how ?
someOther := False;
end;
...
end.
-------------------------------------------------------

Thanks in advance


Pavel


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ObjectPascal All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.