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


Groups > comp.lang.forth > #47189

Re: RESIZE boundary conditions

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: RESIZE boundary conditions
Date 2016-05-16 13:13 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2016May16.151305@mips.complang.tuwien.ac.at> (permalink)
References <2016May15.132631@mips.complang.tuwien.ac.at> <16655e61-afc3-4c42-b635-8a3951a12d96@googlegroups.com>

Show all headers | View raw


november.nihal@gmail.com writes:
>
>   addr1 = 0 , u = 0    ==> If resize can only act on memory previously set aside by allocate or resize, then addr1=0 doesn't make sense as malloc only returns a nil ptr if it's unsuccessful or if size is 0.
>
>   addr1 = 0 , u > 0    ==> ( as above ) 

addr1=0 makes sense at the beginning.  If that works, you can just
initialize the address variable or field with 0 instead of doing some
dummy allocation.

>   addr1 > 0 , u = 0    ==> u = 0 doesnt make sense as you are asking it to resize nothing 

The case that institgated this thread is a string buffer that is
RESIZEd for the size of the string.  In case of an empty string, it
was resized with "0 RESIZE".  Given that an empty string makes sense,
so does 0 RESIZE.  And I am asking it to resize to 0 size.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2016: http://www.euroforth.org/ef16/

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


Thread

RESIZE boundary conditions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-05-15 11:26 +0000
  Re: RESIZE boundary conditions ruvim.pinka@gmail.com - 2016-05-15 06:46 -0700
    Re: RESIZE boundary conditions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-05-15 17:08 +0000
  Re: RESIZE boundary conditions november.nihal@gmail.com - 2016-05-15 09:13 -0700
    Re: RESIZE boundary conditions Albert van der Horst <albert@cherry.spenarnc.xs4all.nl> - 2016-05-15 18:23 +0000
    Re: RESIZE boundary conditions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-05-16 13:13 +0000
      Re: RESIZE boundary conditions Hans Bezemer <the.beez.speaks@gmail.com> - 2016-05-16 15:23 +0200
        Re: RESIZE boundary conditions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-05-16 14:01 +0000
        Re: RESIZE boundary conditions hughaguilar96@gmail.com - 2016-05-16 14:14 -0700
  Re: RESIZE boundary conditions Albert van der Horst <albert@cherry.spenarnc.xs4all.nl> - 2016-05-15 18:13 +0000
    Re: RESIZE boundary conditions anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-05-16 10:32 +0000
      Re: RESIZE boundary conditions Albert van der Horst <albert@cherry.spenarnc.xs4all.nl> - 2016-05-16 22:38 +0000
  Re: RESIZE boundary conditions Hans Bezemer <the.beez.speaks@gmail.com> - 2016-05-16 14:54 +0200

csiph-web