Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Does GCC compile relative addressing within a program?

22 views
Skip to first unread message

Mij

unread,
Jul 23, 2014, 6:14:13 PM7/23/14
to
Folks,

I'm working on a Windows laptop running XP.

I am writing a little program to solve a board puzzle. It uses a
brute force method, and needs to check each permutation of 36 elements
to see if this permutation solves the puzzle. That's going to take a
long time, and I realise that I may be dead before it gets there - but
then, I won't really care about the puzzle any more.

For the permutations, I use a re-entrant function that calls itself,
so the program could go to about 38 functions deep, each one, of
course, storing its local variables.

I plan to put a static variable into the function (or a global,
doesn't really matter) to count iterations, and for every, let's say,
thousand iterations, I would like to save the program to disk in its
present state, so that if it is interrupted, I will be able to reload
it and restart if from the latest save. This is probably dead simple,
but it's something I've never done before, and I don't know how to go
about it.

I had thought that I could, perhaps, find out where my program was in
memory, and simply dump that memory block, but when restored, it would
only work if all jumps and branches, variable addresses, etc. were
relative. Is that how GCC would compile it? I use some global
variables, but the program is quite small - a couple of hundred lines -
and all in one C file.

Thanks for reading my question.

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

0 new messages