Re: how to test this piece of C code



subramanian100in@xxxxxxxxx, India said:

On Mar 10, 3:27 am, Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
subramanian10...@xxxxxxxxx, India said:

Thanks for the suggestion.

Kindly bear with me for the following question.

I am just learning C at present. So I may not need SIZE_MAX memory
for testing purpose now.
However, in real world applications ie in Job envorinment(I am
preparing for interview/skill test, etc), will they have more than
4GB of RAM in order to test such code ?

I doubt it very much. Most code shops have pretty run-of-the-mill
collections of PCs, with as little RAM as they think they can get
away with.

I do not understand this. Kindly explain. Does it mean that in real
world applications SIZE_MAX memory won't be asked from malloc/realloc

No, it doesn't mean that.

or there won't be 4GB of input file for testing ?

No, it doesn't mean that, either. It just means that most companies are
unlikely to have a machine containing that much physical RAM.

malloc/realloc have size_t as parameter type which is unsgined int.
So, doesn't it mean that there may be requirement for 4GB of dynamic
memory ?

size_t may or may not be an unsigned int, and size_t may or may not be
32 bits wide. In your case, it seems, it is - but how do you know how
wide size_t will be on your interviewer's system?

There are always limits to any human endeavour, and that certainly
includes computing. Dealing intelligently with limits is a large part
of the skill involved in programming.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
.



Relevant Pages

  • Re: how to test this piece of C code
    ... testing purpose now. ... in real world applications ie in Job envorinment(I am ... preparing for interview/skill test, etc), will they have more than 4GB ... of RAM in order to test such code? ...
    (comp.programming)
  • Re: OS X on my G3
    ... given sufficient RAM and hard drive space. ... It isn't easy to upgrade the RAM as it requires opening up the machine ... which will leave you less for applications and data. ... or you can find another way to install the software via ...
    (comp.sys.mac.hardware.misc)
  • Re: where do you store app wide data?
    ... Not the JVM.. ... Java applications. ... thats the fault of whoever wrote the application - not Java. ... Files are not stored in RAM when you close them. ...
    (alt.php)
  • Re: OT Camera Raw 5.2 and Photoshop CS4, not CS3
    ... in the IBM/Intel original PC design and is why old PC DOS will run ... address 1 megabyte of RAM. ... but in protected mode it also was ... incapable of running applications written for the 8088 and so it was ...
    (rec.photo.digital.slr-systems)
  • Re: Another whirl with FreeBSD
    ... Most applications will run somewhat faster, ... more RAM (and possibly a larger cache size to fit their ... amd64 code tends to be a bit ... If you are a developer who compiles a lot, ...
    (freebsd-stable)