Hi,

I am hacking on gnome-terminal to switch from popt to GOption command line
option parsing. I have a problem adressing a struct by means of a pointer
to that struct. Consider

=============================================
typedef struct
{
 gboolean option_fullscreen;
/* stuff */
}
  OptionParsingResults;

OptionParsingResults parsing_results;

int main (int argc, char **argv)
{

  OptionParsingResults *results = &parsing_results;
printf("%o %o\n", *results, parsing_results);
}
=============================================

In the main function I create a pointer to the struct in the main scope.
The printf shows that both dereference the same memory spot (equal
numbers).
At some point in main() the option parsing takes places. The
parser writes its results directly into the 'struct parsing_results' like

 &parsing_results.option_fullscreen = foo

However when trying to access the results via the pointer 'results'
I read different values in contrast to reading the outcome using parsing_results,
i.e.

 parsing_results.option_fullscreen != results->option_fullscreen

I have no explanation for this. Can someone shed some light on this, please?

I've attached the current state of my patch for gnome-terminal. You can try this patch and run e.g.
 gnome-terminal --zoom=5

I've added some printf to show the difference.


Regards

--
Christian Kirbach
[EMAIL PROTECTED]

Attachment: gnome-terminal-goption6pre.patch.bz2
Description: application/bzip2

_______________________________________________
gnome-love mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-love

Reply via email to