Sponsored Content
Top Forums Programming C++ segmentation fault while checking for null pointer Post 302396761 by vijay_vasanth on Friday 19th of February 2010 08:19:44 AM
Old 02-19-2010
Hi Vijay,

You are passing a pointer to this function. Ensure that the pointer is valid from where you called this fuction. It should not be pointing to deleted are freed objects.

-Vijay
 

10 More Discussions You Might Find Interesting

1. Programming

segmentation fault

hi all i'm trying to execute a c program under linux RH and it gives me segmentation fault, this program was running under unix at&t anybody kow what the problem could be? thanx in advance regards (2 Replies)
Discussion started by: omran
2 Replies

2. UNIX for Dummies Questions & Answers

Segmentation Fault

hello all, I tried a program on an array to intialise array elements from the standard input device.it is an integer array of 5 elements.but after entering the 4th element it throws a message called "Segmentation Fault" and returns to the command prompt without asking for the 5th element. ... (3 Replies)
Discussion started by: compbug
3 Replies

3. Programming

Hi! segmentation fault

I have written a program which takes a directory as command line arguments and displays all the dir and files in it. I don't know why I have a problem with the /etc directory.It displays all the directories and files untill it reaches a sub directory called peers which is in /etc/ppp/peers.the... (4 Replies)
Discussion started by: vijlak
4 Replies

4. Programming

segmentation fault

Hi, I am having this segmentation fault not in the following program, bt. in my lab program . My lab program is horrible long so cannot post it here bt. I am using the following logic in my program which is giving the segmentation fault. Bt. if I run this sample program as it is it dosen't give... (3 Replies)
Discussion started by: mind@work
3 Replies

5. Programming

segmentation fault

What is segmentation fault(core dumped) (1 Reply)
Discussion started by: gokult
1 Replies

6. Programming

Segmentation fault.

I'm getting a segmentation fault. I'm new to Linux programming. Thanks so much for all of your input.:eek: #include </usr/include/mysql++/mysql++.h> #include <stdio.h> #include <iostream> #include <sstream> #include <string.h> using namespace std; int outputToImport(const char*... (1 Reply)
Discussion started by: sepoto
1 Replies

7. Programming

segmentation fault.

This code is causing a segmentation fault and I can't figure out why. I'm new to UNIX and I need to learn how to avoid this segmentation fault thing. Thank you so much. Thanks also for the great answers to my last post.:):b: int main() { mysqlpp::Connection conn(false); if... (3 Replies)
Discussion started by: sepoto
3 Replies

8. Programming

Using gdb, ignore beginning segmentation fault until reproduce environment segmentation fault

I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this : i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies

9. Programming

Segmentation fault when I pass a char pointer to a function in C.

I am passing a char* to the function "reverse" and when I execute it with gdb I get: Program received signal SIGSEGV, Segmentation fault. 0x000000000040083b in reverse (s=0x400b2b "hello") at pointersExample.c:72 72 *q = *p; Attached is the source code. I do not understand why... (9 Replies)
Discussion started by: jose_spain
9 Replies

10. Programming

C. To segmentation fault or not to segmentation fault, that is the question.

Oddities with gcc, 2.95.3 for the AMIGA and 4.2.1 for MY current OSX 10.14.1... I am creating a basic calculator for the AMIGA ADE *NIX emulator in C as it does not have one. Below are two very condensed snippets of which I have added the results inside the each code section. IMPORTANT!... (11 Replies)
Discussion started by: wisecracker
11 Replies
__UNCONST(3)						   BSD Library Functions Manual 					      __UNCONST(3)

NAME
__UNCONST -- compile time cast-away macro SYNOPSIS
#include <sys/cdefs.h> void __UNCONST(x); void __UNVOLATILE(x); DESCRIPTION
The __UNCONST() macro can be used to omit warnings produced by certain compilers when operating with pointers declared with the const type qualifier in a context without such qualifier. Examples include passing a pointer declared with the const qualifier to a function without such qualifier, and variable assignment from a const pointer to a non-const pointer. In the same vein, the __UNVOLATILE() macro can be used to exclude warnings related to the volatile type qualifier. IMPLEMENTATION NOTES
These macros are implemented by explicitly using unsigned long instead of intptr_t, a signed type guaranteed to hold a pointer. SEE ALSO
cc(1), cdefs(3) CAVEATS
As both macros may hide valid errors, their usage is not recommended unless there is a well-thought reason for a cast. A typical use case for __UNCONST() involve an API that does not follow the so-called ``const correctness'' even if it would be appropriate. Valid use cases of __UNVOLATILE() include passing a volatile pointer to memset(3). BSD
December 16, 2010 BSD
All times are GMT -4. The time now is 05:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy