954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

g_signal() void and float

Why is this?

int kitty(GtkWidget* widget, float* foo)
{
  if(*foo != .5f)
   std::cout << "this usually occurs" << std::endl;
}
int otherFunc(void)
{
  float foo = .5f;
  //assume widget has been created
  g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(kitty), (gpointer)&foo);
}
the_kitoper
Newbie Poster
7 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
 
int otherFunc(void)
{
  float foo = .5f;
  //assume widget has been created
  g_signal_connect(G_OBJECT(widget), "clicked", G_CALLBACK(kitty), (gpointer)&foo);
}


Wouldn't thisfoo be destroyed by the time the event handler kitty is called?

Also, do read up on comparing floating point values. http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm

vijayan121
Posting Virtuoso
1,606 posts since Dec 2006
Reputation Points: 1,159
Solved Threads: 287
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: