TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Peter Fitzsimmons
from: Michael Douglass
date: 1994-06-11 10:12:08
subject: setmem and memset

PF> MD> The compiler will run right through it, never burp at all...  But when
  > MD> you run the program it just acts like it ignores the command.  My
  > MD> question is why doesn't the compiler "Burp" at me? 
This is NOT a
  > MD> command in the Borland run-time library...

PF>Yes, Borland does have this function (it is #defined in mem.h to call memset

Ok.  Why?  I was to the point where I thought it was broken because
setmem would not work (I was thinking memset).  I figured that if it
wasn't the correct command it would burp at me.  So my question is why
is this command supported?

PF>    char myChar[20];
  >    memset(myChar, 0, sizeof(myChar));

So doing the following would not produce the same result?

char *myChar=new char[20];
memset(myChar,0,sizeof(myChar));

Oh, methinks I see!  The size of myChar is 4 because it is a pointer!
Where I was expecting 20... So I should have used sizeof(*myChar)!!!

Michael Douglass
___
 .Mike's Mail Internet:   MICHAEL.DOUGLASS{at}LCHANCE.SAT.TX.US
                   
--- Maximus/2 2.01wb

* Origin: The Rock BBS--410Meg, i486/33, ZyXEL v32bis. (1:387/31)
SEEN-BY: 54/54 620/243 632/348 640/820 690/660 711/409 413 430 807 808 809
SEEN-BY: 711/934 712/353 623 713/888 800/1 2442/0
@PATH: 387/31 1102 3615/50 229/2 2442/0 711/409 54/54 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.