Re: passing a string to a C++ function

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




"Brian Muth" <bmuth@xxxxxxxx> wrote in message
news:eRvE9zoyFHA.1264@xxxxxxxxxxxxxxxxxxxxxxx

> It's an acceptable approach, although a more contemporary solution
> would be to use the standard template library to help with the
> string parsing and manipulation. strtok() is now considered
> "unsafe" (although that alone won't stop me from using it from
> time to time).

There seems to be a move towards warning people that all sorts of
things are "unsafe". I suspect this is a drive by Microsoft to cut
down on the number of people calling them when something crashes :-)

strtok is extremely useful - you just have to be aware of what it
actually does and treat it with respect (and test your code).

C and C++ have always been languages where you have to be aware of
what is going on in memory (allocating, freeing, changing contents)
when you do things. You can't just write it blindly and not worry
about that. Other languages - eg FORTRAN - were designed to
protect you completely from having to worry about memory.

Dave
--
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm



.



Relevant Pages

  • Re: passing a string to a C++ function
    ... although a more contemporary solution would ... > C and C++ have always been languages where you have to be aware of what is ... You can't just write it blindly and not worry about that. ... > having to worry about memory. ...
    (microsoft.public.vc.language)
  • Re: NAS alternative to my junky Airport Extreme
    ... most European languages, won't it? ... memory moving their contents at once -- of 9 and other sizes. ... Hungarian and German both use umlauts. ... What accents do other languages put on the letter A? ...
    (uk.comp.sys.mac)
  • Re: Words on the heap
    ... Forth programs tend to be significantly smaller than equivalent functionality coded in other languages. ... The major reason is that it is optimized to encourage great modularity, so there is much higher code density. ... even on very memory-constrained platforms there is far less incentive to re-use dictionary space. ... On today's PC-type platforms, there is typically such a vast amount of memory available that, with Forth's natural memory conservation, it simply isn't sufficiently attractive to be able to discard portions of the dictionary. ...
    (comp.lang.forth)
  • Re: memory allocation questions (newbie)
    ... I think this means something like "a pointer that is ... prepared to point to a memory location big enough to hold an int." ... I think having multiple exit points is not a good idea. ... experience writing programs in high-level languages. ...
    (comp.lang.c)
  • Re: Which computer language program is best for undergrads?
    ... % with equality constraints ... that relies upon basic features found in many modern languages. ... management which, as I understand it, Matlab does not. ... I'm not sure what you mean by memory management. ...
    (comp.programming)