Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Memory leak of iterations in large hash.
On 3=BF=F919=C0=CF, =BF=C0=C0=FC4=BD=C356=BA=D0, mjc <mjco...@acm.org> wrote
=
:
> On Mar 17, 9:30 pm, iaminsik <iamin...@gmail.com> wrote:
>
>
>
>
> 
acea.null.org> wrote:
> 
).
> 
---- 
----
> 
> 
> 
> 
> 
> 
 
> 
> 
tr \ 
tr \ 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
> One thing I noticed is that there are no local variables in your
> subroutines.

I've never heard of declare variables as 'local' in awk.

>
> I would declare then (in the "function" statement) so there would be,
> for example, no chance of "i" in one routine conflicting with "i" in
> another.- =B5=FB=BF=C2 =C5=D8=BD=BA=C6=AE =BC=FB=B1=E2=B1=E2 -

Can you show an example?

>
> - =B5=FB=BF=C2 =C5=D8=BD=BA=C6=AE =BA=B8=B1=E2 -

Regards.

Remi.

Report this thread to moderator Post Follow-up to this message
Old Post
iaminsik
03-19-08 11:59 PM


Re: Memory leak of iterations in large hash.
In article <5de8b96e-75af-4e74-9c9f-46d9c5dc69d8@u10g2000prn.googlegroups.co
m>,
iaminsik  <iaminsik@gmail.com> wrote:
...
>I've never heard of declare variables as 'local' in awk.

TAWK has true local variables, which is very nice, but in "standard"
AWK it is done via a (widely accepted and practiced) kludge.  See below. 
>
>Can you show an example?

The idea is that you declare your funciton like this:

function foo(arg1,arg2,		tmp1,tmp2,tmp3) {}

And then call it with only 2 args.  The additional args get initalized
to "" (as if they had been passed by the caller as ""), and act like
local variables in the function.

It is also conventional to separate the "real" args from the fake args,
with whitespace, as I have done above.


Report this thread to moderator Post Follow-up to this message
Old Post
Kenny McCormack
03-19-08 11:59 PM


Re: Memory leak of iterations in large hash.
On 3=EC=9B=9419=EC=9D=BC,  =EC=98=A4=ED=9B=8411=EC=8B=9C31=EB=B6=84
, gaze...@
=
xmission.xmission.com (Kenny McCormack)
wrote:
> In article <5de8b96e-75af-4e74-9c9f-46d9c5dc6...@u10g2000prn.googlegroups.=[/color
]
com>,iaminsik =C2=A0<iamin...@gmail.com> wrote:
>
> ...
> 
>
> TAWK has true local variables, which is very nice, but in "standard"
> AWK it is done via a (widely accepted and practiced) kludge. =C2=A0See bel=[/color
]
ow.
>
>
> 
=C2=BC=C3=BB=C2=B1=C3=A2=C2=B1=C3=A2 -
> 
>
> The idea is that you declare your funciton like this:
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 function foo(arg1,arg2, =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 tmp1,tmp2,tmp3) {}
>
> And then call it with only 2 args. =C2=A0The additional args get initalize=[/color
]
d
> to "" (as if they had been passed by the caller as ""), and act like
> local variables in the function.
>
> It is also conventional to separate the "real" args from the fake args,
> with whitespace, as I have done above.

Sorry for this late reply. :)
It's a nice trick.
I'll try!

Best Regards.
Remi.

Report this thread to moderator Post Follow-up to this message
Old Post
iaminsik
03-25-08 08:59 AM


Sponsored Links




Last Thread Next Thread Next
Pages (2): « 1 [2]
Search this forum -> 
Post New Thread

AWK archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 03:28 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.