Re: GTK signals question.
- From: Chris Moller <moller mollerware com>
- To: gtk-app-devel-list gnome org
- Subject: Re: GTK signals question.
- Date: Wed, 05 Mar 2014 14:27:43 -0500
On 03/05/14 13:52, Chris Angelico wrote:
On Thu, Mar 6, 2014 at 5:43 AM, Chris Moller <moller mollerware com> wrote:
gcc supports nested functions as an extension to standard C. I tend to use
them a lot because they operate within the stack frame of the enclosing
function, thereby minimising the amount of information you have to pass.
This is especially valuable in GTK callbacks where you can only pass one
pointer/int.
That's a nice idea as long as you don't let the calling function
return. As far as I know, gcc nested functions don't in any way "hold
onto" the outer state, so there'll be a pile of segfaults waiting for
you if the outer function has returned - like returning a pointer to
an automatic variable.
I'm exploring a bit the circumstances when to, or not to, use nested
fcns. What it's beginning to look like is that they'll work fine in
top-level fcns, and, apparently, GTK modal dialogues, but everything
else is open to question.
Is there a reason you're trying to write high-level code in C?
Habit, mostly. I've been coding in C since the early 80s and I can do
it in my sleep. Python's okay, but I tend to think of it more as a
scripting language rather than something I want to write a 50k-line
application in. (Actually, the app I'm writing now uses Python as it's
scripting language...) I'd never heard of Pike but, looking it up, the
"interpreted" bit makes me wonder about performance.
Give
Python or Pike a shot - both have GTK bindings and are way WAY easier
to write code in. Believe me, I've written plenty of C code (including
GUI handling), and life is just so much better when memory management
isn't part of your daily keyboarding regimen.
ChrisA
PS. Has anyone else noticed that this thread is more than half by
people named Chris?
Years ago, I worked in a lab where about a third of the people were
named Ron. Confusion reigned...
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]