Re: SIGSEGV error received while implementing string functions

  • From: Paul Floyd < >
  • To:
  • Subject: Re: SIGSEGV error received while implementing string functions
  • Date: Sun, 20 Jan 2013 21:40:51 +0100

acsabir wrote:
I'm not using C++. I've not yet learnt it. Is there a way I can achieve this 
in C?

No. You have to do all the management yourself, There are the str* functions to help a bit.

Btw, since I got a copy of the pointer pointing to the string as you say, 
shouldn't I got access to it? I thought, regardless of how many copies there 
are, they still point to the same memory location?

You can read but not write to string literals. In practice they are not stored in one of the areas that you can write to (the heap and stack). An optimizing compiler may make just one copy of duplicate string literals, and in this case if you could modify literals, then you would get some unexpected behaviour.

A+
Paul



SIGSEGV error received while implementing string functions

acsabir 01/17/2013

SIGSEGV error received while implementing string functions

soldatov 01/18/2013

Re: SIGSEGV error received while implementing string functions

paulf 01/18/2013

SIGSEGV error received while implementing string functions

acsabir 01/20/2013

Re: SIGSEGV error received while implementing string functions

Paul Floyd 01/20/2013

Project Features

About this Project

CND was started in November 2009, is owned by DimaZh, and has 153 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20150626.29986a4). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close