🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #1816

Re: PostScript coding style question

#1816
From: Glenn Reid
Date: Wed, 19 Aug 1992 01:45
32 lines
1656 bytes
Rob Bradlee writes
> Is the cleartomark a legitimate way to make sure you've left the stack in  
good
> shape or a cheap trick that absolves you from the effort of thinking?

I think it's a cheap trick, myself :-)

The only justified use of it is if you include arbitrary PostScript
that you do not know or trust (as in an EPS file). If you wrote the
code, you should clean up after yourself.  If you write things
properly, there shouldn't be anything on the stack anyway when you
get to the "cleartomark".

If you really aren't sure what's on the stack, how do you know there
isn't another "mark" (equivalent to a "[", by the way) on the stack
somewhere?

Anyway, I'd avoid using it if I were you.

One of the things that I sometimes do with particularly gnarly bits
of code is to force an error where your "cleartomark" is and see the
contents of the stack, count them, analyze them, then look back at
the code to get rid of anything that shouldn't be there.  For example,
people often use "stringwidth" but forget to pop the unused "Y" value,
and it's still sitting there later.

Just my $.02

--
 Glenn Reid        		NeXTmail: glenn@rightbrain.com
 RightBrain Software		415-326-2974 (NeXTfax 326-2977)
 Palo Alto, California
Technical Details
Message-ID: <858@rtbrain.rightbrain.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!nntp1.radiomail.net!fernwood!rtbrain!rightbrain.com
References: <10087@cg-atla.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!nntp1.radiomail.net!fernwood!rtbrain!rightbrain.com
From: glenn@rightbrain.com (Glenn Reid)
Newsgroups: comp.lang.postscript
Subject: Re: PostScript coding style question
Message-ID: <858@rtbrain.rightbrain.com>
Date: 19 Aug 92 01:45:17 GMT
References: <10087@cg-atla.UUCP>
Sender: glenn@rightbrain.com
Reply-To: glenn@rightbrain.com
Distribution: comp
Lines: 32