Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #10414

Re: Vector push_back() giving SIGSEGV error

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Vector push_back() giving SIGSEGV error
Date 2011-09-23 13:54 +1200
Message-ID <9e277aF9j7U1@mid.individual.net> (permalink)
References <29403061.2519.1316720927293.JavaMail.geo-discussion-forums@yqaa12> <Xns9F68EE6A3EE40myfirstnameosapriee@216.196.109.131> <7524880.1452.1316737057158.JavaMail.geo-discussion-forums@yqmw31>

Show all headers | View raw


On 09/23/11 12:17 PM, sravanreddy001 wrote:

Please keep the context of the message you are replying to, otherwise 
your posts don't make sense.

> Hi Paavo,
>
> <My apologies, I overlooked my question and missed the core part>
>
> Please let me know if you need more info.
> {I'm not a newbie to C++ (may be Intermediate), I checked if its refereing any out-of-bound reference etc.}
>
> The "Links" is a vector<string>  object.
>
> The problem is:
> The size of link has reached its capacity for a size of 4. (during one of the(26th) iterations of this code.)
>
> When I'm trying to add the fifth element to the above vector, it is supposed to increase the size and add this element. But instead it is giving a SIGSEGV error.
>
> True. There are no obvious errors.
>
> Simply put.
> I've a vector, and I was able to add 4 objects to it, and I checked that its capacity is 4. and max_size() is over a 100,000. When I'm trying to add 5th element its returning the Termination Interrupt

You really should do what Paavo and Victor suggested and build a 
complete, self-contained example demonstrating your problem that you can 
post.  Odds are that if you can't, your problem lies elsewhere.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Vector push_back() giving SIGSEGV error sravanreddy001 <sravanreddy001@gmail.com> - 2011-09-22 12:48 -0700
  Re: Vector push_back() giving SIGSEGV error Paavo Helde <myfirstname@osa.pri.ee> - 2011-09-22 15:26 -0500
    Re: Vector push_back() giving SIGSEGV error sravanreddy001 <sravanreddy001@gmail.com> - 2011-09-22 17:17 -0700
      Re: Vector push_back() giving SIGSEGV error Ian Collins <ian-news@hotmail.com> - 2011-09-23 13:54 +1200
      Re: Vector push_back() giving SIGSEGV error Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-23 09:24 +0000
  Re: Vector push_back() giving SIGSEGV error Victor Bazarov <v.bazarov@comcast.invalid> - 2011-09-22 16:30 -0400
    Re: Vector push_back() giving SIGSEGV error sravanreddy001 <sravanreddy001@gmail.com> - 2011-09-22 17:20 -0700
      Re: Vector push_back() giving SIGSEGV error Paavo Helde <myfirstname@osa.pri.ee> - 2011-09-23 00:20 -0500

csiph-web