Return-Path: william@bourbon.usc.edu Delivery-Date: Wed Sep 17 17:46:04 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id m8I0k4NF017161 for ; Wed, 17 Sep 2008 17:46:04 -0700 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id m8I0lLfj001094 for ; Wed, 17 Sep 2008 17:47:21 -0700 Message-Id: <200809180047.m8I0lLfj001094@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: proj 2 ques Date: Wed, 17 Sep 2008 17:47:21 -0700 From: Bill Cheng Someone wrote: > Bill Cheng wrote: > > Someone wrote: > > > > > > If someone uses "-size 2147483647", your code should not > > allocate an array of 2147483648 elements! > > > > I guess the real maximum for size should be 2^32-1=4294967295. > > -- > > Bill Cheng // bill.cheng@usc.edu > > I didn't get this point. If someone uses "-size 2147483647" then system > will not allocate this size of array. > That means there have a maximum of size, otherwise how come system > know2147483648 is an malicious input? 2147483647 is a valid size. It's (2^31)-1. What I meant was that you should not allocate an array of that many elements. You should use a linked list or a dynamic array. When the queue size reaches 2147483647, you should start dropping newly arrived customers! -- Bill Cheng // bill.cheng@usc.edu