473,387 Members | 3,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

segmentation fault on private variable

Hi,
I'm using a class method which read and write on private variable of own
class.
During the first alghoritm cycle, method read and write correclty on
num_elts variable, but during the second cycle as soon as method wants
read (or write) the variable program is aborted and return "segmentation
fault". Why? num_elts is a long variable.

thanks

Andrea
Nov 14 '05 #1
3 2134
jeko wrote:
Hi,
I'm using a class method which read and write on private variable of own
class.
Since C doesn't have "class methods" or "private variables", I think you're
probably in the wrong newsgroup - try comp.lang.c++.
During the first alghoritm cycle, method read and write correclty on
num_elts variable, but during the second cycle as soon as method wants
read (or write) the variable program is aborted and return "segmentation
fault". Why? num_elts is a long variable.


Even the C++ gurus are unlikely to be able to debug code you don't show
them.

--
Chris "electric hedgehog" Dollin
Nov 14 '05 #2
jeko <a.*********@fastwebnet.it> wrote:
I'm using a class method which read and write on private variable of own
class.
During the first alghoritm cycle, method read and write correclty on
num_elts variable, but during the second cycle as soon as method wants
read (or write) the variable program is aborted and return "segmentation
fault". Why? num_elts is a long variable.


Sorry, but it looks as if you picked the wrong newsgroup. You're here
in comg.lang.c and not comp.lang.c++ - and C doesn't have classes,
methods or private variables. But when you post there you probably
post a bit more of real code. From what you write nobody will be
able to tell you what's exactly going wrong and you might get one
of the standard-joke-answers like that the problem is on line 42...
So show at least how the class looks like, how you define the
instance of the class you're using and what you do in your com-
putations. Best would be a small, working program that exhibits the
problem (as an additional benefit one often finds the error when
one tries to cobble together such an example program).

Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #3
jeko ha scritto:
Hi,
I'm using a class method which read and write on private variable of own
class.
During the first alghoritm cycle, method read and write correclty on
num_elts variable, but during the second cycle as soon as method wants
read (or write) the variable program is aborted and return "segmentation
fault". Why? num_elts is a long variable.

thanks

Andrea


Sorry, this is wrong newsgroup:)
Nov 14 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Justin Tang | last post by:
Hi I am wondering about the segmentation fault in PHP. Namely, I'm running PHP version 4.6.9 on my server right now and when I try to process a large piece of text via textarea(3k+), the resulting...
10
by: Vishal Grover | last post by:
Hello Everyone, I am seeing a certain behaviour which I find strange, and am curious to get an explanation to it. I have the following program. #include <iostream> #include <cstdlib> using...
2
by: jeko | last post by:
Hi, I'm using a class method which read and write on private variable of own class. During the first alghoritm cycle, method read and write correclty on num_elts variable, but during the second...
3
by: Zheng Da | last post by:
Program received signal SIGSEGV, Segmentation fault. 0x40093343 in _int_malloc () from /lib/tls/libc.so.6 (gdb) bt #0 0x40093343 in _int_malloc () from /lib/tls/libc.so.6 #1 0x40094c54 in malloc...
3
by: Amar Prakash Tripaithi | last post by:
Hi Friends, I am working on a project of User Interface Class Library. In it, I have to create a class library in "gnu" using c++ and curses library. I am facing problem while I am on the way of...
1
by: Amar Prakash Tripaithi | last post by:
Hi Friends, I am working on a project of User Interface Class Library. In it, I have to create a class library in "gnu" using c++ and curses library. I am facing problem while I am on the way of...
5
by: silverburgh.meryl | last post by:
Hi, I have a segmentation fault in line 66 of GroupResult.h and I can't figure out why that causes any problem, I appreciate if anyone can help. line 66 of Result.h: 66 size_t size()...
3
by: madunix | last post by:
My Server is suffering bad lag (High Utlization) I am running on that server Oracle10g with apache_1.3.35/ php-4.4.2 Web visitors retrieve data from the web by php calls through oci cobnnection...
3
by: jr.freester | last post by:
I have created to classes Matrix and System. System is made up of type matrix. ---------------------------------------------------------------------------------- class Matrix { private: int...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.