10-11-2004
Could following be the reason?
In main() I have two objects of different classes say class1 & class2.
Class1 and class2 both uses pointer variables. Class1 initializes all the pointer variables but class2 doesn't.
My observation is:
If I just instantiate class1 and class2 and then start using it no problem is occurring. (That is class2 pointer variables by default getting initialized to NULL).
But if I instantiate class1 and allocate some memory to its pointer member variables, immediately free it, and then instantiate class2, I am surely getting dangling pointer in class2 members.
Is it the right cause I have analyzed?
10 More Discussions You Might Find Interesting
1. Programming
I received a warning when I tried to compile my program that said:
warning: comparison between pointer and integer
Could you please explain to me what this means, and in what ways I could possibly fix this?
Thanks for your help! (2 Replies)
Discussion started by: sjung10
2 Replies
2. Programming
can u tell me the reson that why we should not delete a pointer twice.?
if we delete ponter twice then what happen and why this happen
Regards,
Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies
3. UNIX for Dummies Questions & Answers
Hello,
I am in following situation.-
COUNT=`ls -l | wc -l`
echo $COUNT
---> 26
NO_OF_FILES=$COUNT-1
echo $NO_OF_FILES
---> 26-1
Here, I want the output to be 25. How could I do this. It seems simple, but I am not getting it. Please help me. (2 Replies)
Discussion started by: The Observer
2 Replies
4. Programming
A question to ask.
seq1 = "eeeeeeeeeeeeeeeeee";
seq2 = "dddddddddddddddddddd";
char a = '*';
strcat(*seq2, &a);
strcat(*seq1, seq2);
compilation
warning: passing arg 1 of `strcat' makes pointer from integer without a cast
thanks (4 Replies)
Discussion started by: cdbug
4 Replies
5. Programming
If one wants to get a start address of a array or a string or a block of memory via a function, there are at least two methods to achieve it:
(1) one is to pass a pointer-to-pointer parameter, like:
int my_malloc(int size, char **pmem)
{
*pmem=(char *)malloc(size);
if(*pmem==NULL)... (11 Replies)
Discussion started by: aaronwong
11 Replies
6. Programming
I use solaris10,following is tcp client code:
#include "cliserv.h"
int main(int argc,char argv){
struct sockaddr_in serv;
char request,reply;
int sockfd,n;
if(argc!=2)
err_quit("usage: tcpclient <IP address of server>");
if((sockfd=socket(PF_INET,SOCK_STREAM,0))<0)
... (1 Reply)
Discussion started by: konvalo
1 Replies
7. Shell Programming and Scripting
I would like to know the maximum integer that a variable can hold. Actually one of my variable holds value 2231599773 and hence the script fails to process it.Do we have any other data type or options available to handle this long integers? (9 Replies)
Discussion started by: michaelrozar17
9 Replies
8. Solaris
hello,
i am writing a script that takes the UID from the PASSWD and then i want
to increse the Number by one. for the Next user.
i cannot get this to work that a variable is as interger
example:
set i = 0
set $i = $+1
it's in tcsh if it's mather (10 Replies)
Discussion started by: shatztal
10 Replies
9. Programming
Hi guys :D
I am still playing with my C handbook and yes, as you can see I have small problem as always :cool:
I wrote a C code
#include <stdio.h> #define MESSAGE 100 int main(void) { char input_mes - Pastebin.com
And when I try to compile it I get following errors from gcc
... (1 Reply)
Discussion started by: solaris_user
1 Replies
10. UNIX for Dummies Questions & Answers
I'm trying to write a programme which scans strings to find how many vowels they contain. I get an error saying that I'm trying to compare a pointer and an integer inif(*v == scanme){. How can I overcome this ? Also, the programme seems to scan only the first word of a string e.g.: if I type "abc... (1 Reply)
Discussion started by: fakuse
1 Replies
LEARN ABOUT MOJAVE
tk_setclass
Tk_SetClass(3) Tk Library Procedures Tk_SetClass(3)
__________________________________________________________________________________________________________________________________________________
NAME
Tk_SetClass, Tk_Class - set or retrieve a window's class
SYNOPSIS
#include <tk.h>
Tk_SetClass(tkwin, class)
Tk_Uid
Tk_Class(tkwin)
ARGUMENTS
Tk_Window tkwin (in) Token for window.
char *class (in) New class name for window.
_________________________________________________________________
DESCRIPTION
Tk_SetClass is called to associate a class with a particular window. The class string identifies the type of the window; all windows with
the same general class of behavior (button, menu, etc.) should have the same class. By convention all class names start with a capital
letter, and there exists a Tcl command with the same name as each class (except all in lower-case) which can be used to create and manipu-
late windows of that class. A window's class string is initialized to NULL when the window is created.
For main windows, Tk automatically propagates the name and class to the WM_CLASS property used by window managers. This happens either
when a main window is actually created (e.g. in Tk_MakeWindowExist), or when Tk_SetClass is called, whichever occurs later. If a main win-
dow has not been assigned a class then Tk will not set the WM_CLASS property for the window.
Tk_Class is a macro that returns the current value of tkwin's class. The value is returned as a Tk_Uid, which may be used just like a
string pointer but also has the properties of a unique identifier (see the manual entry for Tk_GetUid for details). If tkwin has not yet
been given a class, then Tk_Class will return NULL.
KEYWORDS
class, unique identifier, window, window manager
Tk Tk_SetClass(3)