Re: Building from existing files - was Bypassing the Conversion Wi



I do appreciate the assistance and I'll certainly provide more details should
I have a problem in the future - as I did with the posting for the C4267
problem.

With respect to this particular project, you are correct that the software
is obsolete. So is the hardware - it was already approaching obsolescence
when it began to be installed on USN combat vessels in the late 1970's. The
economics of doing a complete rewrite of the software are prohibitive. This
is not an option. It is not my choice. I have developed a separate, stand
alone piece of software that does follow current (as of VS 2005) Microsoft
practice. It's a lot cleaner than the 12-year-old software at issue here and
it also performs the same I/O substantially faster.

I've checked around and I'm the only person here at Crane who doing
maintenance/development using Microsoft - everyone else appears to be using
Linux. That makes it more difficult since there is no one here to consult -
I'm left with consulting with people online. Another difficulty is that
because much of the work is secret, I have no internet access in the lab and
that means that any online help necessitates leaving the lab and going to my
workstation.

While this particular piece of code is not secret, I'm still loath to post
large swatches of code online. And, in this particular instance, there
really wasn't a need to post more than I did in order to answer this one
question. I trust we agree that it is best to strive for parsimony whenever
possible.

Regards,
Paul Hager
--
Maritime Electronic Warfare, Crane NSWC


"Joseph M. Newcomer" wrote:

They disappeared because your code is obsolete. You should upgrade the code to be
consistent with modern practice.

You continue the poor posting practice by given an example that uses a variable whose
declaration is not shown.

When you post an example, you *will* show the declarations of all of your variables!

You have not justified why you are using the obsolete data type 'char' to represent text,
or why 300 makes sense (for example, a CString would probably be a better choice). But if
you read the definition of strlen, it states that it is

size_t strlen(const char * str);

so it means that strlen is returning a size_t. A size_t can be 64 bits wide, therefore,
using an int variable (and I'm only guessing, since you couldn't be bothered to show us
the declaration) you should have been using a size_t variable.

Reading the documentation always helps.
joe

On Mon, 30 Mar 2009 09:37:03 -0700, Paul Hager <paul.hager@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:

I already acknowledged I should have provided an example. Once I set the
Project Properties as indicated, the code compiled and the C2665 errors
disappeared.

Unless there is a good reason to change the code, I see no advantage in it.
Is there a good reason?

As for the other error, it is C4267 and it arises as follows:

char temp[300];
...
j = strlen(temp) - 1; // C4267 error size_t to int

I assume there is a switch that will handle this as well. Since strlen is a
standard C function I can't think of any reason why this shouldn't work as
written. And, I reiterate, it does compile correctly in both the (currently
running) 4.2 version and the VS 2005 conversion wizard output.
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

.



Relevant Pages

  • Re: Consideration on pointer declarations
    ... 'char * pc;' by lets forget about that, ... posting). ... good practice, both for writing code and for reading it later. ... Putting one declaration per ...
    (comp.lang.c)
  • Re: ????Dragon Lady???
    ... >>reason it's been done here, but it's not the only reason. ... Guess it is case dependant huh? ... >>> I have put a couple of people's real names on my Kook site who normally go ... because they've been posting my real name here. ...
    (alt.support.chronic-pain)
  • Re: TALULA SIGNING OFF :(
    ... LC, Ruada and a few others feel that if a person is posting in ADH for any reason, they are druggies. ... group of people that really do care about those in this group and the new people that pop in to ask a question and leave. ...
    (alt.support.chronic-pain)
  • [OT] Top-Posting (was Re: wich is faster)
    ... IMO a posting should be a snapshot of somebody's thoughts. ... If you look at this closely, this is simply good writing ... everything I wrote above was with regard to your reason ... IMO this is the equivalent of having no quotations at all. ...
    (comp.programming)
  • Re: Time to return to RATs roots
    ... People reply sometimes to what might be argued to be dumb questions ... imagine you posting any reasonable answers to these earnest questions. ... One reason is that I don't know exactly what your'e asking. ... Patrick Turner. ...
    (rec.audio.tubes)