Article View: comp.sys.atari.st
Article #39444Re: C question
From: Daniel B. Suthers
Date: Thu, 14 Dec 1989 01:49
Date: Thu, 14 Dec 1989 01:49
31 lines
1932 bytes
1932 bytes
In article <875@lzaz.ATT.COM> hcj@lzaz.ATT.COM (HC Johnson) writes:
>you can have char *fred[] = "hello";
>
>but not
>char fred[] = "hello";
Mr. Johnson is correct; to use the second form you must use the form
static char fred[] = "HELLO"
or the way he has it set up as an array of pointers (sometimes). If
you set it up as an array of pointers it will only work if the machine
uses a linear address scheme.
As this is not gauranteed in the standards, It could break if ported
to another machine or different compiler.
The point is to beware of utilizing side effects when writing code. The next
operating system release or compiler change CAN and OFTEN DOES wreak havock
with your programs.
For those who have not seen it yet, the newsgroup "comp.unix.wizards" is
very helpful for those just starting in C and unix. They are always eager
to lend support. The newsgroup seems to be not so much for the wizards as
it is for the neophytes who don't have a wizard handy to help them.
-------------------------------------------------------------------------------
Dan Suthers, Analyst, Pacific Bell
uucp: {backbone}!pacbell!pbeos!dbsuther
-------------------------------------------------------------------------------
Youth's a difficult time, and it gets harder the longer you try to draw it out.
-------------------------------------------------------------------------------
Technical Details
Message-ID:
<31352@pbhya.PacBell.COM>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!think!ames!pacbell!pbhya!dbsutherReferences:
<8912050802.AA12717@ucbvax.Berkeley.EDU> <875@lzaz.ATT.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!think!ames!pacbell!pbhya!dbsuther From: dbsuther@PacBell.COM (Daniel B. Suthers) Newsgroups: comp.sys.atari.st Subject: Re: C question Summary: beware of programming to side effects Message-ID: <31352@pbhya.PacBell.COM> Date: 14 Dec 89 01:49:22 GMT References: <8912050802.AA12717@ucbvax.Berkeley.EDU> <875@lzaz.ATT.COM> Reply-To: dbsuther@PacBell.COM (Daniel B. Suthers) Organization: Pacific * Bell, San Ramon, CA Lines: 31