public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Newb question about code style
@ 2004-03-18 10:14 Robert Dewar
  0 siblings, 0 replies; 10+ messages in thread
From: Robert Dewar @ 2004-03-18 10:14 UTC (permalink / raw)
  To: nathan, sashang; +Cc: gcc

(sorry this is not threaded, using an internet cafe in Bangkok where all
I have is a junk telnet connection for email)

<<
Why the original *fixed* *width* ASCII character set has a character whose
width is not only different, but depends on where it is, is one of those
things. (Of course Knuth would question why have a character code for a
character with no glyph.)

nathan     
>>

I would guess that nathan has never seem a teletype machine :-)

By the way, there is nothing in the ASCII (really I suppose you mean the
ANSI standard commonly referred to as ASCII) standard that says this is 
a fixed width character set. Representation details like this are not part
of that standard. By the way null and DEL both have zero wdith :-)

(and if you don't know why DEL is alll bits on, you never used paper tape :-)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Newb question about code style
  2004-03-17 12:23     ` Nathan Sidwell
  2004-03-17 13:05       ` Dave Korn
@ 2004-03-17 17:09       ` Ian Lance Taylor
  1 sibling, 0 replies; 10+ messages in thread
From: Ian Lance Taylor @ 2004-03-17 17:09 UTC (permalink / raw)
  To: Nathan Sidwell; +Cc: gcc

Nathan Sidwell <nathan@codesourcery.com> writes:

> > Ok thanks that makes a difference. I still don't understand the
> > mixing of tabs and spaces though. The gnu website seems to be down
> > so I can't read http://www.gnu.org/prep/standards_toc.html.
> a tab is a character which moves to the next multiple of 8. do not abuse
> that by trying a different spacing. usually, tabs are used to get to the
> rightmost multiple of 8, and then (pairs of) spaces to get further right.
> 
> Why the original *fixed* *width* ASCII character set has a character whose
> width is not only different, but depends on where it is, is one of those
> things. (Of course Knuth would question why have a character code for a
> character with no glyph.)

Are you just kvetching, or truly mystified?  Surely the explanation is
obvious.  At least, it is obvious to anybody above a certain age.

Besides, ASCII is only fixed width from 0x20 to 0x7e.

Ian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Newb question about code style
  2004-03-17 13:05       ` Dave Korn
@ 2004-03-17 15:22         ` Bernd Jendrissek
  0 siblings, 0 replies; 10+ messages in thread
From: Bernd Jendrissek @ 2004-03-17 15:22 UTC (permalink / raw)
  To: Dave Korn; +Cc: gcc

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Mar 17, 2004 at 02:51:04PM +0200, Dave Korn wrote:
> >(Of course Knuth would 
> > question why have a character code for a character with no glyph.)
> 
>   GOK what he'd make of Ctrl-G!

A character whose glyph has such a strongly modulated spatial spectrum
that its rendition on a CRT display causes nonlinear electron
excitations in the screen grid, that the beats are discriminated and
become audible.  Everyone knows, of course, that ^G is silent on laptops
and other computers with those fancy flat-panel displays.

^H would be an anti-character, then, but with equal spin, so it needs
another particle in the interaction to destroy a character.

^K exploits a stack overflow in the ASCII universe, causing arbitrary
code to be executed which advances the current position (cursor?) down a
couple lines.  Just think of what the creators of ASCII *could* have
made ^K do if they had been malicious...

...such as they demonstrated with ^L, which not only executes arbitrary
code for show, it is an active DoD attack, not only moving the current
position, but denying access to the desired screen/page of paper.

But worst of all is ^[ - exits insert mode in vi and workalikes to enter
command mode.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQFAWGsK/FmLrNfLpjMRAm/wAJwJrJqQJ0p8tw4bmixSuvNMOGrO8QCfcyYP
gBek44mO4PTo/Ayo35/Ig5c=
=+sGQ
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: Newb question about code style
  2004-03-17 12:23     ` Nathan Sidwell
@ 2004-03-17 13:05       ` Dave Korn
  2004-03-17 15:22         ` Bernd Jendrissek
  2004-03-17 17:09       ` Ian Lance Taylor
  1 sibling, 1 reply; 10+ messages in thread
From: Dave Korn @ 2004-03-17 13:05 UTC (permalink / raw)
  To: gcc


> -----Original Message-----
> From: gcc-owner On Behalf Of Nathan Sidwell
> Sent: 17 March 2004 12:23

> Why the original *fixed* *width* ASCII character set has a 
> character whose width is not only different, but depends on 
> where it is, is one of those things. 

  If you think that's bad, what about the fact that it also contains a
character whose width is not only different, depending on where it is, but
also is always _negative_!

  That'll be CR, of course.

  Then there's LF.  Defined in the same terms, it's a character whose width
is always zero - but has a non-zero imaginary component!

  I guess it shows why it's worth having separate abstractions for
characters and glyphs....

>(Of course Knuth would 
> question why have a character code for a character with no glyph.)

  GOK what he'd make of Ctrl-G!

    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Newb question about code style
  2004-03-17 12:16   ` sashan
  2004-03-17 12:21     ` Paul Brook
  2004-03-17 12:22     ` sashan
@ 2004-03-17 12:23     ` Nathan Sidwell
  2004-03-17 13:05       ` Dave Korn
  2004-03-17 17:09       ` Ian Lance Taylor
  2 siblings, 2 replies; 10+ messages in thread
From: Nathan Sidwell @ 2004-03-17 12:23 UTC (permalink / raw)
  To: sashan; +Cc: gcc

sashan wrote:

> Ok thanks that makes a difference. I still don't understand the mixing 
> of tabs and spaces though. The gnu website seems to be down so I can't 
> read http://www.gnu.org/prep/standards_toc.html.
a tab is a character which moves to the next multiple of 8. do not abuse
that by trying a different spacing. usually, tabs are used to get to the
rightmost multiple of 8, and then (pairs of) spaces to get further right.

Why the original *fixed* *width* ASCII character set has a character whose
width is not only different, but depends on where it is, is one of those
things. (Of course Knuth would question why have a character code for a
character with no glyph.)

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Newb question about code style
  2004-03-17 12:16   ` sashan
  2004-03-17 12:21     ` Paul Brook
@ 2004-03-17 12:22     ` sashan
  2004-03-17 12:23     ` Nathan Sidwell
  2 siblings, 0 replies; 10+ messages in thread
From: sashan @ 2004-03-17 12:22 UTC (permalink / raw)
  Cc: gcc

 

> Ok thanks that makes a difference. I still don't understand the mixing 
> of tabs and spaces though. The gnu website seems to be down so I can't 
> read http://www.gnu.org/prep/standards_toc.html.
>
Actually that's a silly question - I understand now.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Newb question about code style
  2004-03-17 12:16   ` sashan
@ 2004-03-17 12:21     ` Paul Brook
  2004-03-17 12:22     ` sashan
  2004-03-17 12:23     ` Nathan Sidwell
  2 siblings, 0 replies; 10+ messages in thread
From: Paul Brook @ 2004-03-17 12:21 UTC (permalink / raw)
  To: gcc; +Cc: sashan

On Wednesday 17 March 2004 12:13, sashan wrote:
> Ok thanks that makes a difference. I still don't understand the mixing of
> tabs and spaces though. The gnu website seems to be down so I can't read
> http://www.gnu.org/prep/standards_toc.html.

IIRC the coding standards specify that (8 character wide) tabs should be used. 
However this rule isn't always enforced as well as it could be.

Paul

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Newb question about code style
  2004-03-17 12:13 ` Andrew Haley
@ 2004-03-17 12:16   ` sashan
  2004-03-17 12:21     ` Paul Brook
                       ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: sashan @ 2004-03-17 12:16 UTC (permalink / raw)
  Cc: gcc

Andrew Haley wrote:

>sashan writes:
> > Hello
> > 
> > I decided to have a look at gcc and how it works. I've built the 3.4 
> > tree, set a breakpoint in main using gdb and worked from there. I notice 
> > that some of the code in gcc.c mixes tabs and spaces and code looks like 
> > it is outside a loop is actually inside. Is this intentional?
>
>You've probably got different tab stop settings.  Tab stops are 8
>spaces wide in gcc.
>
>  
>
Ok thanks that makes a difference. I still don't understand the mixing of tabs and spaces though. The gnu website seems to be down so I can't read http://www.gnu.org/prep/standards_toc.html.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Newb question about code style
  2004-03-17 12:00 sashan
@ 2004-03-17 12:13 ` Andrew Haley
  2004-03-17 12:16   ` sashan
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Haley @ 2004-03-17 12:13 UTC (permalink / raw)
  To: sashan; +Cc: gcc

sashan writes:
 > Hello
 > 
 > I decided to have a look at gcc and how it works. I've built the 3.4 
 > tree, set a breakpoint in main using gdb and worked from there. I notice 
 > that some of the code in gcc.c mixes tabs and spaces and code looks like 
 > it is outside a loop is actually inside. Is this intentional?

You've probably got different tab stop settings.  Tab stops are 8
spaces wide in gcc.

Andrew.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Newb question about code style
@ 2004-03-17 12:00 sashan
  2004-03-17 12:13 ` Andrew Haley
  0 siblings, 1 reply; 10+ messages in thread
From: sashan @ 2004-03-17 12:00 UTC (permalink / raw)
  To: gcc

Hello

I decided to have a look at gcc and how it works. I've built the 3.4 
tree, set a breakpoint in main using gdb and worked from there. I notice 
that some of the code in gcc.c mixes tabs and spaces and code looks like 
it is outside a loop is actually inside. Is this intentional?

-- 
sashan
http://www.cs.auckland.ac.nz/~sgov008



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-03-18  9:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-18 10:14 Newb question about code style Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
2004-03-17 12:00 sashan
2004-03-17 12:13 ` Andrew Haley
2004-03-17 12:16   ` sashan
2004-03-17 12:21     ` Paul Brook
2004-03-17 12:22     ` sashan
2004-03-17 12:23     ` Nathan Sidwell
2004-03-17 13:05       ` Dave Korn
2004-03-17 15:22         ` Bernd Jendrissek
2004-03-17 17:09       ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).