Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.os2.programmer.misc > #1209

Re: if ((pszStem) && (pszStem))...

From Paul Ratcliffe <abuse@orac12.clara34.co56.uk78>
Newsgroups comp.os.os2.programmer.misc
Subject Re: if ((pszStem) && (pszStem))...
Date 2013-08-03 14:30 +0000
Message-ID <slrnkvq50t.1488.abuse@news.pr.network> (permalink)
References <51fa8619$0$12578$91cee783@newsreader03.highway.telekom.at> <51fa965a$0$6564$9b4e6d93@newsspool4.arcor-online.net> <11p86vVJT4Oe-pn2-BmKvqZWb97Xu@slamain> <51fb6f5b$0$2222$91cee783@newsreader04.highway.telekom.at> <11p86vVJT4Oe-pn2-ddjXJu2kfdzK@slat60-1>

Show all headers | View raw


On Fri, 02 Aug 2013 13:16:54 -0500, Steven Levine
<steve53@nomail.earthlink.net> wrote:

>> > Does the current code do anything to pszBuffer before the sprintf?
>> No. The whole block is -
>> 
>>     DosEnterCritSec();
>>     if ((pszStem) && (pszStem))
>>        {
>>        sprintf( pszBuffer, "%s:", pszStem);
>>        }
>>     DosExitCritSec();

And what does it do with it after? And what are the types of these
variables anyway? And where are the checks for overflow?

If people are going to ask questions like this, then they should at
least give enough context. This is not one which has. The questions
cannot be answered without guesswork, so why bother?

> FWIW, I suspect the cost of entering and exiting the critical section 
> far exceeds the cost of the sprintf.
> 
> Also, it speed is really an issue, rewriting the sprintf as a strcpy, 
> strcat combo will be measurably faster.

And leave you open to even more buffer overruns errors and other such
nasties. Code like this belongs in the last century.

Anyone who wants their sanity preserved would use STL strings and stop
all this mucking about with pointers and such like.

Run-time speed is largely irrelevant these days for trivial amounts of
code like this is. It is ease and reliability of development that is
important, but some people just don't seem to get it.

Back to comp.os.os2.programmer.misc | Previous | NextPrevious in thread | Find similar


Thread

if ((pszStem) && (pszStem))... Andreas Buchinger <SendSpam@your.address> - 2013-08-01 18:00 +0200
  Re: if ((pszStem) && (pszStem))... Marcel Müller <news.5.maazl@spamgourmet.org> - 2013-08-01 19:09 +0200
    Re: if ((pszStem) && (pszStem))... "Steven Levine" <steve53@nomail.earthlink.net> - 2013-08-01 13:59 -0500
      Re: if ((pszStem) && (pszStem))... Andreas Buchinger <SendSpam@your.address> - 2013-08-02 10:35 +0200
        Re: if ((pszStem) && (pszStem))... "Steven Levine" <steve53@nomail.earthlink.net> - 2013-08-02 13:16 -0500
          Re: if ((pszStem) && (pszStem))... Andreas Buchinger <SendSpam@your.address> - 2013-08-03 14:18 +0200
          Re: if ((pszStem) && (pszStem))... Paul Ratcliffe <abuse@orac12.clara34.co56.uk78> - 2013-08-03 14:30 +0000

csiph-web