[comp.sys.mac.programmer] Declaring "thePort"

cash@csmil.umich.edu (Howard Cash) (05/10/89)

What are the consequences of declaring a local variable within 
a function called "thePort" and setting it explicitly with 
GetPort(thePort).  I find the following code in some examples
in LSC TransSkel (release 2.0)

DoWClose ()
{
GrafPtr		thePort;
MenuHandle	m;
Integer		i, mItems;
Str255		iTitle, wTitle;

    GetPort (&thePort);		/* grafport of window to be closed */

Seems kind of strange to me....

-howard

ksitze@nmsu.edu (Kevin Sitze) (05/10/89)

In article <cash@csmil.umich.edu's message of 10 May 89 06:23:27 GMT>
>What are the consequences of declaring a local variable within 
>a function called "thePort" and setting it explicitly with 
>GetPort(thePort).  I find the following code in some examples
>in LSC TransSkel (release 2.0)
>
>DoWClose ()
>{
>GrafPtr	thePort;
>MenuHandle	m;
>Integer	i, mItems;
>Str255		iTitle, wTitle;
>
>   GetPort (&thePort);		/* grafport of window to be closed */
>
>Seems kind of strange to me....

Nothing wrong with it at all.  Brushup on your scoping rules and look
at the program again...

			-Kelesi
--
------------------------------------+-------------------------------
From the Macintosh of: Kevin Sitze  | Disclamer: Who the heck needs
                                    |   a disclamer?  After all, Dan
EMail: ksitze%NMSU.edu              |   Quayle doesn't.
SMail: 601 S. Melendres             +-------------------------------
       Las Cruces, NM  88005        | "We have the answers, the
------------------------------------+  trouble lies in finding the
"The difference between intelligence|  questions..."
and stupidity is that intelligence  | "The information is there,
has a limit."           - anonymous |  finding it is another story."
The dolt confuses you -- more --    |	   	    - Any consultant
------------------------------------+-------------------------------