Article View: comp.std.c
Article #4741Re: size_t
From: Larry Huang
Date: Thu, 01 Feb 1996 21:16
Date: Thu, 01 Feb 1996 21:16
11 lines
912 bytes
912 bytes
I was writing some code to manage a table the other day. I used a size_t to keep track of the size of the table, and I defined a macro SIZE_T_MAX as (size_t)(-1) for making sure the table doesn't get too large. Then I suddenly realize that it may not work as I thought. An implementation can restrict the size of a data object to 32 K (is my memory correct here?), but the value of (size_t)(-1) can at the same time be very large (e.g. ULONG_MAX). So my question is, is there a way to find out what the maximum allowable size of a data object is under an implementation? Larry
Technical Details
Message-ID:
<DM48Fv.5Ay@novice.uwaterloo.ca>Path:
arc1-ca.pugleaf.net!novice.uwaterloo.ca!lhuangShow Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!novice.uwaterloo.ca!lhuang From: lhuang@swen3.uwaterloo.ca (Larry Huang) Subject: Re: size_t Message-ID: <DM48Fv.5Ay@novice.uwaterloo.ca> Sender: lhuang@swen.uwaterloo.ca Date: Thu, 1 Feb 1996 21:16:43 GMT Nntp-Posting-Host: swen.uwaterloo.ca Organization: University of Waterloo