Need recommendations for code modularization

E

ern

I inherited a huge C application and most of it is in one file. I'd
like to modularize it into several different files. Is there a good
resource for learning the best way to link C files together... and
maybe some good conventions to use?

Thanks,
 
K

Karl Malbrain

ern said:
I inherited a huge C application and most of it is in one file. I'd
like to modularize it into several different files. Is there a good
resource for learning the best way to link C files together... and
maybe some good conventions to use?

Places to start:

1) global variables: divide the functions by the variables they access.
2) structure definitions: divide the functions by the structures they
use.

Hope this helps. karl m
 
I

Ian

ern said:
I inherited a huge C application and most of it is in one file. I'd
like to modularize it into several different files. Is there a good
resource for learning the best way to link C files together... and
maybe some good conventions to use?
Your compiler manuals?

Look for logical groupings of functions and variables and keep them
together in the new files.

The biggest problem you will find will be converting between static
variables (or functions) in the one file to global/shared across many
files. You will either have to make things global, or create some form
of encapsulation, depending or you style preference. In my experience,
the pain will lead to a better design, but you had better have a good
set of tests before you start the process.

Ian
 
M

matt

I am currently going through the same thing. I have been trying to
make accessors and mutator functions that act on the global variables.
Also, I have been using a program called Understand for C++ by
Scientific Toolworks Inc (www.scitools.com). It generates a lot of
information about your code. For example if you click on a variable it
tells you were it is defined, used and modified. It tells you what
functions call other functions. It has saved me a great deal of time,
although the cost was a little step.
 
C

Chuck F.

matt said:
I am currently going through the same thing. I have been trying

Same thing as what? Without context you make no sense. See my sig
below. Please be sure to read the URL before posting again.
to make accessors and mutator functions that act on the global
variables. Also, I have been using a program called Understand

There are no such things in C.
for C++ by Scientific Toolworks Inc (www.scitools.com). It

C++ is another language, found down the hall to the right.
generates a lot of information about your code. For example if
you click on a variable it tells you were it is defined, used
and modified. It tells you what functions call other functions.
It has saved me a great deal of time, although the cost was a
little step.

It is remotely possible that with context your comments could have
been topical. Without it, they are just off topic nonsense here.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 
K

Keith Thompson

Chuck F. said:
matt said:
I am currently going through the same thing. I have been trying

Same thing as what? Without context you make no sense. See my sig
below. Please be sure to read the URL before posting again.
[snip]

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>

I suggest updating the boilerplate slightly. It's been brought to my
attention that there's another workaround for Google's interface
problems, one that might be more convenient for some users. Rather
than going through the "show options" link, you can:

Click the "Reply" link at the bottom of the article.
Click the "Preview" button.
Click the "Edit Message" button.

Chris F.A. Johnson has updated his web page to reflect this.

Since Google users are going to be viewing this from their web
browsers anyway, it's probably sufficient just to point to Chris's web
page rather than repeating the instructions.
 
C

Chuck F.

Keith said:
[snip]

I suggest updating the boilerplate slightly. It's been brought to my
attention that there's another workaround for Google's interface
problems, one that might be more convenient for some users. Rather
than going through the "show options" link, you can:

Click the "Reply" link at the bottom of the article.
Click the "Preview" button.
Click the "Edit Message" button.

Chris F.A. Johnson has updated his web page to reflect this.

Since Google users are going to be viewing this from their web
browsers anyway, it's probably sufficient just to point to Chris's web
page rather than repeating the instructions.

I'm not sure I agree. I suspect the googler doesn't want to break
off whatever thread he is reading to check another webpage,
although they probably can without harm on most browsers. Thus I
think having a suitable mechanism right under their noses will help.

I gather that the new method is simply another alternative, and
requires conscious effort, rather than being the default. This is
stupid, because nobody wants to wait for more intermediate pages to
arrive.


--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 
R

Randy Howard

Chuck F. wrote
(in article said:
Keith said:
[snip]

I suggest updating the boilerplate slightly. It's been brought to my
attention that there's another workaround for Google's interface
problems, one that might be more convenient for some users. Rather
than going through the "show options" link, you can:

Click the "Reply" link at the bottom of the article.
Click the "Preview" button.
Click the "Edit Message" button.

Chris F.A. Johnson has updated his web page to reflect this.

Since Google users are going to be viewing this from their web
browsers anyway, it's probably sufficient just to point to Chris's web
page rather than repeating the instructions.

I'm not sure I agree. I suspect the googler doesn't want to break
off whatever thread he is reading to check another webpage,
although they probably can without harm on most browsers. Thus I
think having a suitable mechanism right under their noses will help.

BTW, I seem to remember that Google snips sigs ENTIRELY when
displayed in their web interface. As such, when you post text
in your sig on how to work around google interface issues, they
may never see it at all.
 
M

mensanator

Randy said:
Chuck F. wrote
(in article said:
Keith said:
[snip]

I suggest updating the boilerplate slightly. It's been brought to my
attention that there's another workaround for Google's interface
problems, one that might be more convenient for some users. Rather
than going through the "show options" link, you can:

Click the "Reply" link at the bottom of the article.
Click the "Preview" button.
Click the "Edit Message" button.

Chris F.A. Johnson has updated his web page to reflect this.

Since Google users are going to be viewing this from their web
browsers anyway, it's probably sufficient just to point to Chris's web
page rather than repeating the instructions.

I'm not sure I agree. I suspect the googler doesn't want to break
off whatever thread he is reading to check another webpage,
although they probably can without harm on most browsers. Thus I
think having a suitable mechanism right under their noses will help.

BTW, I seem to remember that Google snips sigs ENTIRELY when
displayed in their web interface.

No, it doesn't.
As such, when you post text
in your sig on how to work around google interface issues, they
may never see it at all.

In fact, I get yelled at because not only are they displayed,
but they are included in the quoting.
 
R

Richard Heathfield

Chuck F. said:
Thus I
think having a suitable mechanism right under their noses will help.

(Subject line: "Housebreaking googlers")

Did you mean "Housetraining"? In the UK at least, "housebreaking" has a
completely different meaning.

I can't help thinking of a guy in a black beret, a mask over the eyes, a
hooped yellow-and-black jersey, a coarse sack with "SWAG" written on it in
large black letters, a jemmy or crowbar, and a laptop. Presumably he only
has dial-up at home, is disgusted with his phone bill, and would therefore
rather use someone else's landline for his surfing.
 
L

Logan Shaw

Richard said:
Chuck F. said:


(Subject line: "Housebreaking googlers")

Did you mean "Housetraining"? In the UK at least, "housebreaking" has a
completely different meaning.

Nope, in the US, "housebroken" describes a pet which has been trained
to deal with its bodily functions in a way that's appropriate for
indoor life. And "housebreaking" is the verb form.

"housebreaking" isn't really used in the US to refer to breaking into
a house. It's just called "breaking in" or "burglarizing" or "robbing".

- Logan
 
R

Randy Howard

(e-mail address removed) wrote
(in article
Randy said:
Chuck F. wrote
(in article said:
Keith Thompson wrote:

[snip]

I suggest updating the boilerplate slightly. It's been brought to my
attention that there's another workaround for Google's interface
problems, one that might be more convenient for some users. Rather
than going through the "show options" link, you can:

Click the "Reply" link at the bottom of the article.
Click the "Preview" button.
Click the "Edit Message" button.

Chris F.A. Johnson has updated his web page to reflect this.

Since Google users are going to be viewing this from their web
browsers anyway, it's probably sufficient just to point to Chris's web
page rather than repeating the instructions.

I'm not sure I agree. I suspect the googler doesn't want to break
off whatever thread he is reading to check another webpage,
although they probably can without harm on most browsers. Thus I
think having a suitable mechanism right under their noses will help.

BTW, I seem to remember that Google snips sigs ENTIRELY when
displayed in their web interface.

No, it doesn't.
As such, when you post text
in your sig on how to work around google interface issues, they
may never see it at all.

In fact, I get yelled at because not only are they displayed,
but they are included in the quoting.

Hmmm, I am either misremembering then, or maybe only when you
search the archive you get this behavior? I distinctly remember
sigs being missing somewhere in the google interface.
 
O

ozbear

Chuck F. said:


(Subject line: "Housebreaking googlers")

Did you mean "Housetraining"? In the UK at least, "housebreaking" has a
completely different meaning.

<snip>

No, he probably meant what he said. "Housebreak" is a common term for
training a pet not to urinate or defecate is one's house.

Look it up.

Oz
 
M

Mark McIntyre

No, he probably meant what he said. "Housebreak" is a common term for
training a pet not to urinate or defecate is one's house.

RJH's point was that in UK English, the word for that is "housetrain"
whereas housebreaking is burglary.
Mark McIntyre
 
C

Chris F.A. Johnson

<snip>

No, he probably meant what he said. "Housebreak" is a common term for
training a pet not to urinate or defecate is one's house.

My Oxford Concise gives "housebreaker" = "burglar", hence
housebreaking as breaking into houses, but gives "house-broken" =
"house-trained".
 
M

Mark McIntyre

My Oxford Concise gives "housebreaker" = "burglar", hence
housebreaking as breaking into houses, but gives "house-broken" =
"house-trained".

Ah, English as she is spoke. :)


Mark McIntyre
 
N

Nick Keighley

Keith said:
I suggest updating the boilerplate slightly. It's been brought to my
attention that there's another workaround for Google's interface
problems, one that might be more convenient for some users. Rather
than going through the "show options" link, you can:

Click the "Reply" link at the bottom of the article.
Click the "Preview" button.
Click the "Edit Message" button.

I just use Reply/Post ***before typing anything***, google then states
that the body of my message must contain some text and handily
puts the correctly quoted text of the message being replied to. Just
two key strokes. Does this not work for some people?
 
M

Michael Wojcik

My Oxford Concise gives "housebreaker" = "burglar", hence
housebreaking as breaking into houses, but gives "house-broken" =
"house-trained".

The real danger, of course, are housebreakers who aren't themselves
housebroken.

M-W (which is a somewhat suspect source, but this is Usenet) claims
that the use of "housebreak" to mean "make housebroken" is a back-
formation from "housebroken", from 1938. They give 1900 as the
date for first use of "housebroken" in this sense, but no etymology;
I assume it's a simple portmanteau of "house" and "broken" in the
sense of "tamed", as in "break a wild horse to the saddle".


--
Michael Wojcik (e-mail address removed)

Thus, the black lie, issuing from his base throat, becomes a boomerang to
his hand, and he is hoist by his own petard, and finds himself a marked man.
-- attributed to a "small-town newspaper editor in Wisconsin"
 
C

Chris F.A. Johnson

The real danger, of course, are housebreakers who aren't themselves
housebroken.

M-W (which is a somewhat suspect source, but this is Usenet)

Actually, Merriam-Webster is the only "true" Webster's dictionary,
in that it is descended from the original Webster. Many others use
the name, Webster.
 
M

mensanator

Nick said:
I just use Reply/Post ***before typing anything***, google then states
that the body of my message must contain some text and handily
puts the correctly quoted text of the message being replied to. Just
two key strokes. Does this not work for some people?

Probably for the same reason nobody had previously discovered
my [Reply][Preview][Edit Message] pathway. It's non-intuitive.
What made you want to post without saying anything? I had
figured that previewing nothing should at least be harmless.

But it's one mouse-click (keystroke?) less, which makes it the
same as the [Show Options][Reply] pathway which makes it
the most efficient since it does not require scrolling back to the
top of the message.

Not that the Google-bashing trolls will care. (And I do not include
Keith Thompson and Chris F. A. Johnson here since they are
genuinely concerned about the issue.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top