🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1891

Re: string literals - lvalues ?

#1891
From: Steve Clamage
Date: Sat, 02 Sep 1995 05:52
21 lines
1337 bytes
krotoff@boy.rector.msu.su (Alexsander Krotoff) writes:

>I have a questio: is it mentioned in the c++ draft standard are
>string literals lvalues or not ? Is it possible to take an address
>of string ?

A string literal represents a null-terminated array of characters
with static storage duration. When you write
	"abc"
in an expression (except as the operand of sizeof), it is
immediately converted to the address of the first char in the array
which consists of 'a', 'b', 'c', '\0'.

You cannot write &"abc", because that would be the address of an
address, and has no meaning.
--
Steve Clamage, stephen.clamage@eng.sun.com
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <428qq7$jlp@engnews2.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
References: <427hu8$2k8@alpha.phys.msu.su>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back
Date: 02 Sep 95 05:52:05 GMT
Approved: fjh@cs.mu.oz.au
Return-Path: <daemon@ncar.UCAR.EDU>
From: clamage@Eng.Sun.COM (Steve Clamage)
Newsgroups: comp.std.c++
Subject: Re: string literals - lvalues ?
X-Original-Date: 2 Sep 1995 05:41:27 GMT
Organization: Sun Microsystems Inc., Mountain View, CA
Message-ID: <428qq7$jlp@engnews2.Eng.Sun.COM>
References: <427hu8$2k8@alpha.phys.msu.su>
X-Newsreader: NN version 6.5.0 #21 (NOV)