delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/17/15:43:28

Message-Id: <3.0.6.32.19990217154316.009c0100@pop.netaddress.com>
X-Sender: pderbysh AT pop DOT netaddress DOT com
X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.6 (32)
Date: Wed, 17 Feb 1999 15:43:16 -0500
To: djgpp AT delorie DOT com
From: Paul Derbyshire <pderbysh AT usa DOT net>
Subject: Re: Problem with Stack Overflow
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

BTW, this (ugh) macro (yuck, bleah) will return the size of an array:



#define size_of_array(a) (sizeof(a)/sizeof((a)[0]))

then you use size_of_array(my_array).

Also, you may want to avoid ugliness with arrays and macros by switching to
C++. The Standard Library vector realloc()s itself as needed and has a
member function size().

-- 
   .*.  "Clouds are not spheres, mountains are not cones, coastlines are not
-()  <  circles, and bark is not smooth, nor does lightning travel in a
   `*'  straight line."    -------------------------------------------------
        -- B. Mandelbrot  |http://surf.to/pgd.net
_____________________ ____|________     Paul Derbyshire     pderbysh AT usa DOT net
Programmer & Humanist|ICQ: 10423848|

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019