comp.lang.ada
 help / color / mirror / Atom feed
From: kst@alsys.com (Keith Thompson @pulsar)
Subject: Re: C-Ada Import of struct's -- Help
Date: Thu, 20 Oct 1994 00:36:32 GMT
Date: 1994-10-20T00:36:32+00:00	[thread overview]
Message-ID: <Cxy4Cw.47@alsys.com> (raw)
In-Reply-To: 3816kn$n4e@schonberg.cs.nyu.edu

In <3816kn$n4e@schonberg.cs.nyu.edu> dewar@cs.nyu.edu (Robert Dewar) writes:
> "Also remember that a C string must be null terminated"
> 
> be careful not to confuse here, there is no such requirement in C. 
> Certain C library routines (but by no means all) require strings to
> be null terminated, and string constants are null terminated, but there
> is no general requirement in C that corresponds to this quote.

Not a requirement, but a definition.  Section 7.1.1 of the ANSI C
standard says

	A string is a contiguous sequence of characters terminated by
	and including the first null character.

This is merely a small confusion of terminology, though.  An Ada string
is simply an array of characters (of a particular type).  It is important
to remember that a C array of characters (char[]) may or may not contain
a "string"; a C pointer to [array of] character (char*) may or may not
point to a "string".

-- 
Keith Thompson (The_Other_Keith)  kst@alsys.com
TeleSoft^H^H^H^H^H^H^H^H Alsys, Inc.
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718
/user/kst/.signature: I/O error (core dumped)



  parent reply	other threads:[~1994-10-20  0:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-18 10:20 C-Ada Import of struct's -- Help Bob Wells #402
1994-10-18  9:58 ` David Emery
1994-10-18 19:11   ` Robert Dewar
1994-10-19 10:02     ` David Emery
1994-10-20  0:36     ` Keith Thompson @pulsar [this message]
  -- strict thread matches above, loose matches on Subject: below --
1994-10-19 13:57 Bob Wells #402
1994-10-18  3:34 mcnett michael david
1994-10-18  9:48 ` David Emery
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox