Re: Duplicate code
- From: c.prog.fan@xxxxxxxxxxxxxx
- Date: Tue, 9 Dec 2008 06:12:11 -0800 (PST)
nick_keighley_nos...@xxxxxxxxxxx wrote:
On 8 Dec, 22:57, c.prog....@xxxxxxxxxxxxxx wrote:
nick_keighley_nos...@xxxxxxxxxxx wrote:
In fact if they don't do that I don't see how other
parts of your program can tell which of a or b are set correctly.
Note : this a sample program so actual code differs from it say that
is more complex. Also I don't get what you mean here ; Can you explain
please ?
no not really. If you explain what you are trying to do I might
be able to suggest a sensible design (or someone else might).
The slightly snotty attitude doesn't help you either.
It seems really odd to me that you initialise only one
of two fields. You also cannot tell which one is initialised
without examining something external to the structure. For
instance your 'select' variable may be global
Have you looked at typedef and union? They might be applicable
to you program
Sure typedef was used in original code.Union ? I thought I am the only
one here who over simplifies.
as I said, slightly snotty
--
Nick Keighley
Hi ,
Some notes :
1.As I already said a model is just a model not matching completely
with the original phenomenon. In the particular case structures have
been there for some time and that means that some functions use them
the way they are. Do they look odd ? yes maybe ; but even now I prefer
them like they are , though this may change. Also for the model there
is initialization but in practice there are many various functions
working with them. The ones who work with sub-structures usually act
as duals on both. So the act of updating is simultaneous in most cases
at least it is what I (suppose to) know now. Maybe the names I chose
were not the best also the functions. And interesting fact is that
some suggestions seemed to be ok since they prevent code duplication
(at least this is what my eyes see). Even it was implemented and
worked and it doesn't seem to contain bugs and appears ( to me ) that
it does not do extra work either. Maybe I can work with that too
(personal preference). Of course there are better ways to be found all
the time.
2.I did not mean to act as one who knows more ; In fact I think
everyone here knows more about programming in general and c
programming in particular. That's what the ID stands for "a c prog
(ramming) fan" not a "c programmer" or anything alike. I was just
trying to say that a specific method seems to solve the problems I
currently recognize in a particular project with someone who has
little knowledge. Note that if I post the actual code and everyone
make suggestions ( there would be so many I am sure ) then I would not
be learning because my knowledge, IQ, experience etc is limited and I
can step not run.
3.Please excuse me everyone because it seems that some got sad with my
sayings here ; I may not post on this group anymore.
Thanks for your patience.
.
- Follow-Ups:
- Re: Duplicate code
- From: nick_keighley_nospam
- Re: Duplicate code
- References:
- Duplicate code
- From: c . prog . fan
- Re: Duplicate code
- From: nick_keighley_nospam
- Re: Duplicate code
- From: c . prog . fan
- Re: Duplicate code
- From: nick_keighley_nospam
- Re: Duplicate code
- From: c . prog . fan
- Re: Duplicate code
- From: nick_keighley_nospam
- Duplicate code
- Prev by Date: Re: pointer questions
- Next by Date: Re: making bytes out of bits
- Previous by thread: Re: Duplicate code
- Next by thread: Re: Duplicate code
- Index(es):
Relevant Pages
|