473,287 Members | 1,964 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,287 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 2126
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.