>On Tue, 20 Jul 2004 14:16:56 -0700, Spike <[EMAIL PROTECTED]> wrote:
>> I prefer not to set function local variables to an specific 
>type until I'm
>> actually about to use them. I alwasy initialize them to an 
>empty string if I
>> can't initialize them to their final value. That is, I will 
>initialize
>> structures and arrays up front if I know they will 
>definitely hold a value
>> at some point. Otherwise I will initialize them to an empty string.
>
>I initialize variables to 0 and seeing this discussion made me realize
>that my choice is driven by my C / C++ background, where 0 is
>'null'... old habits die hard!

Thinking about it, it probably makes more sense to initialize to 0 because
that is a valid value for either a string or a number.

I guess I use "" because it is the closest that you can get to a null in CF
(short of something like chr(0), but that doesn't feel too good either) and
it's how CF brings back NULLs from a database.

This is heading off rapidly into the world of curiosities and probably
doesn't have much bearing on the readability or maintainability of anyone's
code, but I always like to know 'how other people are doing it' for a sanity
check of my own approach if nothing else.

>
>> 1. I'm lazy and it's a bit slower to type queryNew('unknown') etc.
>
>...and 0 is even faster to type! :)
>
>At least we're all in agreement that using 'var' (and therefore having
>to initialize variables) is a good thing, especially for things like
>query variables that many people otherwise forget...

Yep...

Incidentally, does anyone know if CFFTP is a full scope or a normal
variable?

CFHTTP is a normal variable, so you can make it thread safe, but CFFILE
isn't.

I have never checked any of the others like CFPOP, CFDIRECTORY, CFSEARCH
etc. Has anyone else?

Spike

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to