TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Daniel Lynes
from: Jonathan de Boyne Pollard
date: 1996-12-23 11:37:24
subject: Protected mode diffef

DL>
  > JdeBP> The problem is nothing to do with the respective operating systems,
  > JdeBP> and everything to do with the heap management in your C++ compiler's
  > JdeBP> runtime library.  Ironically, it seems that the converse of your
  > JdeBP> complaint is true :  the C++ compiler that you are using for OS/2
  > JdeBP> has more efficient heap management than the C++ compiler that you
  > JdeBP> are using for DOS+Windows 95.
  >
  > Just what exactly are you saying here?  It doesn't make any sense.  I'm us
  > the same compiler on both platforms (Watcom 10.0a), and I'm using statical
  > allocated memory, not dynamic.  As a result, it's only the variable being
  > placed on the heap, not the area of memory to which the pointer points.
  > [...]
  > Like I said above, I'm not using the heap.
  > [...]
  > I will stress it again.  The memory I was reading, I did not allocate.
  > However, I was not writing to it, [...]
DL>

  All of which are wrong, since they completely contradict the code that
  you posted.  Here is the code that you posted once again:

DL>
  >  int main( int argc, char **argv )
  >  {
  >   .
  >   .
  >   .
  >   p=( char * )malloc( 239 ) ;
  >   p2=( char * )malloc( 72 ) ;
  >   .
  >   .
  >   .
  >   p3=( char * )malloc( 239 ) ;
  >   /*
  >    * The next line and the following one are GPF enabled (in Win95),
  >    * but not in OS/2.
  >    */
  >    memcpy( p3, p+extraBits, 239 ) ;
  >    write( handle, p3, 239 ) ;
  >    .
  >    .
  >    .
  >  }
DL>

  You _are_ using dynamically allocated memory (the calls to `malloc' are
  plain to see), and it _is_ access to heap memory wherein you say that
  you are encountering GPFs (you are writing to heap memory pointed to by
  `p3' in the call to `memcpy', and reading from the same memory in the
  call to `write').

  If you are confused, it is because you aren't reading my response in the
  context of the code that you _actually_posted_.

  > JdeBP <
___
 X MegaMail 2.10 #0:
--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-725167) (2:440/4)
SEEN-BY: 270/101 711/401 409 410 413 430 808 809 934 955 712/407 515 624 628
SEEN-BY: 713/317
@PATH: 440/4 141/209 270/101 712/515 711/808 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™.