Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Martin Krivka
  Where is Martin Krivka?
 
 Czech Republic
 Martin Krivka
 To: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 Tags
Subject: RE: declare warning
Thread ID: 310907 Message ID: 311101 # Views: 40 # Ratings: 0
Version: Visual FoxPro 9 Category: Projects and Design
Date: Tuesday, June 28, 2011 9:18:29 PM         
   


> >
> >
> >
> > Do not agree. Who will say if it is declared or not ? Calling program ? The addls/ascan can be used, but while tests included, the function is about 7x times slower than normal call. (Declare is about 5000x slower).
> >
> > Let we say have guid() function. You need use it "as is". Just =guid(). Do not thinking 'is declared or not ?'.
> >
> > Martin
>
> I didn't mean test it. Just tell it in the calling program and in my tests testing it for 100000 records made it only 22 milliseconds slower. ie:
>
>
Start = Seconds()
> Declare Integer UuidCreate In 'RPCRT4.dll' String @pguid
> Declare Integer StringFromGUID2 In 'Ole32.dll' ;
>   string rguid, String @lpsz, Integer cchMax
> 
> Create Cursor xx (myID c(36) Default MakeGuid(),something i)
> Insert Into xx (something) Values (0) && using default declare runs in function
> Local ix
> For ix = 1 To 100000
>   Insert Into xx (myID, something) Values (MakeGuid(.T.), m.ix) && declare supressed
> Endfor
> 
> ? Seconds() - m.start
> 
> Procedure MakeGuid(tlDeclared)
>   Local pguid,rguid
>   If (!m.tlDeclared)
>     Declare Integer UuidCreate In 'RPCRT4.dll' String @pguid
>     Declare Integer StringFromGUID2 In 'Ole32.dll' ;
>       string rguid, String @lpsz, Integer cchMax
>   Endif
> 
>   pguid=Replicate(Chr(0),16)
>   rguid=Replicate(Chr(0),80)
> 
>   UuidCreate(@m.pguid)
>   StringFromGUID2(m.pguid,@m.rguid,40)
>   Return Chrtran(Strconv(Left(m.rguid,76),6),'{}','')
> endproc

>
> Cetin Basoz
>
> .Net has got better.Think about moving - check my blog:
> My Blog
> Blog (mirror) - sounds to be down


Yes, this is fast checking. But absolutely unneeded. If you declare in parent program (and you must, because must pass parameter to MakeGuid :), really do not need test in sub-program. Also, from global point of view, the MakeGuid() is public function, used on more places. =MakeGuid() seems good, but =MakeGuid( sometimes_F_sometimes_T_) is a little strange, what you mean ?

Just, I think that easier (and faster that others) way is better. Do not worry about declare. Suppose, that all winapi functions are accessible.

With peace in mind
Martin

ENTIRE THREAD

declare warning Posted by Martin Krivka @ 6/27/2011 7:37:00 AM
RE: declare warning Posted by Martina Jindrov√° @ 6/27/2011 7:58:16 AM
RE: declare warning Posted by Martin Krivka @ 6/27/2011 9:04:43 AM
RE: declare warning Posted by onytoo @ 6/27/2011 8:29:25 PM
RE: declare warning Posted by Ilya Rabyy @ 6/28/2011 6:57:26 PM
RE: declare warning Posted by onytoo @ 6/28/2011 9:27:55 PM
RE: declare warning Posted by Ilya Rabyy @ 6/29/2011 11:38:01 PM
RE: declare warning Posted by onytoo @ 6/30/2011 9:18:57 AM
RE: declare warning Posted by Martin Krivka @ 6/28/2011 9:29:38 PM
RE: declare warning Posted by onytoo @ 6/28/2011 9:41:42 PM
RE: declare warning Posted by Martin Krivka @ 6/28/2011 10:19:09 PM
RE: declare warning Posted by Ilya Rabyy @ 6/29/2011 11:42:56 PM
RE: declare warning Posted by Martin Krivka @ 6/30/2011 8:46:05 AM
RE: declare warning Posted by Ilya Rabyy @ 6/30/2011 4:34:36 PM
RE: declare warning Posted by Martin Krivka @ 6/30/2011 5:20:37 PM
RE: declare warning Posted by Ilya Rabyy @ 6/30/2011 6:21:06 PM
RE: declare warning Posted by onytoo @ 6/30/2011 10:14:51 PM
RE: declare warning Posted by Ilya Rabyy @ 6/30/2011 10:45:55 PM
RE: declare warning Posted by onytoo @ 7/1/2011 12:13:20 AM
RE: declare warning Posted by Samir H. @ 7/1/2011 5:53:19 AM
RE: declare warning Posted by onytoo @ 7/1/2011 10:59:04 AM
RE: declare warning Posted by Ilya Rabyy @ 7/1/2011 4:37:50 PM
RE: declare warning Posted by onytoo @ 7/1/2011 7:35:38 PM
RE: declare warning Posted by Mike Yearwood @ 7/1/2011 2:31:27 AM
RE: declare warning Posted by Cetin Basoz @ 6/28/2011 11:02:20 AM
RE: declare warning Posted by Martin Krivka @ 6/28/2011 12:09:38 PM
RE: declare warning Posted by onytoo @ 6/28/2011 12:15:01 PM
RE: declare warning Posted by Samir H. @ 6/28/2011 2:17:07 PM
RE: declare warning Posted by Martin Krivka @ 6/28/2011 3:41:05 PM
RE: declare warning Posted by Cetin Basoz @ 6/28/2011 4:15:06 PM
RE: declare warning Posted by Martin Krivka @ 6/28/2011 9:18:29 PM
RE: declare warning Posted by onytoo @ 6/30/2011 9:28:04 AM