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


Groups > comp.lang.c > #107877

Re: Need help fixing a "previously defined" error

Newsgroups comp.lang.c
Subject Re: Need help fixing a "previously defined" error
From Peabody <waybackNO584SPAM44@yahoo.com>
Date 2017-04-08 12:51 -0500
Message-ID <20170408-175108.70.0@Peabody.ssl.astraweb.com> (permalink)
References <20170408-130720.9.0@Peabody.ssl.astraweb.com> <ocat16$nro$1@dont-email.me>
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


James Kuyper says...

 > It declares that strtrim identifies a function that
 > takes one argument of type char*, and returns a value of
 > type char*. The "lpszA" is purely decorative as far as C
 > itself is concerned. It uses prefixes that tell you
 > something about the meaning of the string that it points
 > at, but I'm not familiar with those prefixes.

 > Most likely because they used the Microsoft compiler,
 > while you used LCC. The C standard gives implementations
 > a lot of freedom to differ from each other, and
 > "strtrim" is one example of that. strtrim() is NOT part
 > of the C standard library, so this might seem to be a
 > non-conforming implementation of <string.h>. However,
 > 7.31.13 says that names beginning with "str", "mem", or
 > "wcs" followed by a lower case letter may be added to
 > future versions of <string.h>, and according to 7.1.3p1,
 > all such names are therefore reserved for use as
 > identifiers with external linkage. strtrim matches that
 > pattern. Because such names are reserved, LCC is
 > entitled to add such names to it's own version of
 > <stdio.h>, and the TI code has undefined behavior.
 > "Undefined behavior" means that Microsoft compiler is
 > free to accept such code and have it execute exactly as
 > expected, but it also means that LCC is allowed to
 > reject such code.

Ok, but what's confusing me is that "StrTrim" is a legit
Microsoft string function, although possibly (only) for C++:

https://msdn.microsoft.com/en-us/library/windows/desktop/bb773454
(v=vs.85).aspx

So is this just a mistake - the wrong case chosen for the
letters - and TI is really trying to call the MS
function to trim a string?  But what string would that be?
"lpszA" doesn't appear anywhere else in the source code
either, but I think it also has some kind of special meaning
involving Unicode.

 > The TI code declares strtrim(), but makes no use of it?
 > That's weird, but unused declarations are not uncommon
 > in code that has a lot of history. If so, that's trivial
 > to deal with - just remove the declaration. If you made
 > a mistake while searching for other uses of strtrim,
 > removing that declaration will help you find them.

I did try that, and the compile worked.  But somehow I'm not
comfortable with it not needing to be there.  This part of
the code has to do with writing strings to a .txt file where
you would not want trailing spaces or null terminations.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-08 08:07 -0500
  Re: Need help fixing a "previously defined" error James Kuyper <jameskuyper@verizon.net> - 2017-04-08 10:47 -0400
    Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-08 12:51 -0500
      Re: Need help fixing a "previously defined" error Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-04-08 20:03 +0100
      Re: Need help fixing a "previously defined" error Spiros Bousbouras <spibou@gmail.com> - 2017-04-08 19:06 +0000
      Re: Need help fixing a "previously defined" error James Kuyper <jameskuyper@verizon.net> - 2017-04-08 15:17 -0400
  Re: Need help fixing a "previously defined" error Spiros Bousbouras <spibou@gmail.com> - 2017-04-08 15:29 +0000
  Re: Need help fixing a "previously defined" error Barry Schwarz <schwarzb@dqel.com> - 2017-04-08 09:21 -0700
    Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-08 13:04 -0500
      Re: Need help fixing a "previously defined" error James Kuyper <jameskuyper@verizon.net> - 2017-04-08 15:33 -0400
        Re: Need help fixing a "previously defined" error Spiros Bousbouras <spibou@gmail.com> - 2017-04-08 19:51 +0000
        Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-08 16:24 -0500
    Re: Need help fixing a "previously defined" error Keith Thompson <kst-u@mib.org> - 2017-04-08 18:45 -0700
  Re: Need help fixing a "previously defined" error bartc <bc@freeuk.com> - 2017-04-08 17:46 +0100
    Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-08 13:19 -0500
  Re: Need help fixing a "previously defined" error David Brown <david.brown@hesbynett.no> - 2017-04-09 12:38 +0200
    Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-09 07:52 -0500
      Re: Need help fixing a "previously defined" error David Brown <david.brown@hesbynett.no> - 2017-04-09 17:02 +0200
        Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-09 18:20 -0500
          Re: Need help fixing a "previously defined" error James Kuyper <jameskuyper@verizon.net> - 2017-04-09 22:06 -0400
          Re: Need help fixing a "previously defined" error David Brown <david.brown@hesbynett.no> - 2017-04-10 09:07 +0200
            Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-10 09:11 -0500
              Re: Need help fixing a "previously defined" error David Brown <david.brown@hesbynett.no> - 2017-04-10 17:31 +0200
                Re: Need help fixing a "previously defined" error Peabody <waybackNO584SPAM44@yahoo.com> - 2017-04-10 12:48 -0500

csiph-web