Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > How to check whether malloc has allocated memory properly in case ifmalloc(0) can return valid pointer

Reply
Thread Tools

How to check whether malloc has allocated memory properly in case ifmalloc(0) can return valid pointer

 
 
Richard Maine
Guest
Posts: n/a
 
      12-30-2010
glen herrmannsfeldt <(E-Mail Removed)> wrote:

> In comp.lang.fortran Ron Shepard <(E-Mail Removed)> wrote:
> (snip)
>
> > A couple of years after the mil-std-1754 specification, there were a
> > couple of vendors that mentioned a DOE (Department of Energy)
> > specification for asynchronous I/O in fortran.


> I don't know about CDC Fortran and asynchronous I/O, though.


CDC definitely supported asynchronous I/O, though I don't know whether
it had any relation to the aforementioned DOE spec, which I don't know
anything about.

CDC used bufferin/bufferout, which I believe was also used by some other
vendors, but CDC's is the one I most recall working with.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
 
Reply With Quote
 
 
 
 
Richard Maine
Guest
Posts: n/a
 
      12-30-2010
<(E-Mail Removed)> wrote:

> In article <1juazq5.1hrqqa3138fzaeN%(E-Mail Removed)>,
> Richard Maine <(E-Mail Removed)> wrote:


> >NIST, for example, is not a government agency.


> Er, no, sorry. If you mean the National Institute of Standards and
> Technology, it states "NIST is an agency of the U.S. Department of
> Commerce." You may have meant ANSI or IEEE. I agree with your point,
> but not your example!


Oops, yes.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
 
Reply With Quote
 
 
 
 
nmm1@cam.ac.uk
Guest
Posts: n/a
 
      12-30-2010
In article <(E-Mail Removed)>,
Ron Shepard <(E-Mail Removed)> wrote:
>
> NIST is
>funded by congress, just like NASA, EPA, NIH, NSF, and numerous
>other government agencies. It is not a cabinet level department,
>but neither are those other agencies. If I remember correctly, NIST
>(and before that NBS) is under the department of commerce.


This side of the pond, we call them quangos.


Regards,
Nick Maclaren.
 
Reply With Quote
 
Ron Shepard
Guest
Posts: n/a
 
      12-30-2010
In article <1juazq5.1hrqqa3138fzaeN%(E-Mail Removed)>,
http://www.velocityreviews.com/forums/(E-Mail Removed)ature (Richard Maine) wrote:

> NIST, for example, is not a
> government agency.


I agree with the rest of your post, but not this part. NIST is
funded by congress, just like NASA, EPA, NIH, NSF, and numerous
other government agencies. It is not a cabinet level department,
but neither are those other agencies. If I remember correctly, NIST
(and before that NBS) is under the department of commerce.

Some examples of a standards organizations that are not government
agencies are IEEE, ANSI, and UL.

$.02 -Ron Shepard
 
Reply With Quote
 
Stephen Sprunk
Guest
Posts: n/a
 
      12-30-2010
On 30 Dec 2010 09:28, gvkalra wrote:
> On Dec 16, 2:58 pm, "BartC" <(E-Mail Removed)> wrote:
>> One issue might be that, if you call malloc(0) enough times, you can run out
>> of memory!

>
> How would I run out of memory if I am allocation 0 bytes all the time ?


This question has been answered multiple times in this thread.

S

--
Stephen Sprunk "God does not play dice." --Albert Einstein
CCIE #3723 "God is an inveterate gambler, and He throws the
K5SSS dice at every possible opportunity." --Stephen Hawking
 
Reply With Quote
 
Richard Maine
Guest
Posts: n/a
 
      12-30-2010
Ron Shepard <(E-Mail Removed)> wrote:

> In article <1juazq5.1hrqqa3138fzaeN%(E-Mail Removed)>,
> (E-Mail Removed)ature (Richard Maine) wrote:
>
> > NIST, for example, is not a
> > government agency.

>
> I agree with the rest of your post, but not this part.


See my sheepish reply to Nick. I got NIST and ANSI mixed up. You'd think
I would know, as I used to volunteer for a ANSI (specifically X3J3).

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
 
Reply With Quote
 
glen herrmannsfeldt
Guest
Posts: n/a
 
      12-30-2010
In comp.lang.fortran (E-Mail Removed) wrote:
> In article <ifh9v5$ib9$(E-Mail Removed)-september.org>,

(I wrote)

>>The first reference to standard Fortran 66 that I remember was
>>that the Mortran2 processor was written in, and expected to generate,
>>standard Fortran 66 (at least as close as it could.)


> I think that I once installed that and supported it, but cannot
> remember anything about it!


Before Fortran 77, free form semicolon termintated statements,
alphanumeric statement labels (surrounded by colons), block
structure using angle brackets (< and >), WHILE, UNTIL, and DO
that work with such blocks, labelled and unlabelled EXIT and
NEXT statements for loops, and you can add your own macros,
similar to some of the uses of the C preprocessor.

>>All character processing was done using A1 format for input and
>>output, with the expectation (maybe not required by the standard)
>>that one could read in, store in a variable, compare, and write
>>out an INTEGER variable using A1 format.


> It wasn't. And it didn't always work. The ICL 1900 as what would
> later be called a RISC machine, and did comparisons by subtraction,
> with overflow trapped for both integer and real!


Yes, but if it doesn't then you pretty much can't do any useful
character processing at all. MORTRAN2 uses the first card of the
macro file as its character set, read in A1 format.

Even so, the comparisons are done in few enough places that you
could modify the processor if it could be done, but in a
different way.

> Some (usually originally IBM) Fortran programs used D.P. to get more
> characters, and then came BADLY unstuck on systems that normalised
> upon loading or storing floating-point numbers


Fortunately OS/360 doesn't do that, but, yes, there are systems
like that.

> And, of course, some compilers copied only one bit of LOGICAL.


-- glen
 
Reply With Quote
 
glen herrmannsfeldt
Guest
Posts: n/a
 
      12-30-2010
In comp.lang.fortran e p chandler <(E-Mail Removed)> wrote:
(snip, someone wrote)

>> It is kind of interesting that none of these mainframe/supercomputer
>> class machines were based on the x86 intel architecture, isn't it?


> [OT] Huh? The 8086 was a 16 bit bus version of the 8088. The 8088 came from
> the 8080, the 8080 from the 8008 and the 8008 from the 4004. The 4004 was
> designed to do 4 bit (BCD) arithmetic inside a Japanese calculator. I
> remember seeing a 4004 based computer design inside a university EE lab back
> in 1972.


Well, the 8086 came before the 8088, but otherwise that is pretty
much the way it went. The 8086 instruction set is designed to be
assembly source compatible (with appropriate macros in a few cases)
with the 8080 instructions set.

The Intel iPSC is based on a hypercube array of 80286/80287
processor units.

-- glen
 
Reply With Quote
 
glen herrmannsfeldt
Guest
Posts: n/a
 
      12-30-2010
In comp.lang.fortran Richard Maine <(E-Mail Removed)> wrote:
(snip on asynchronous I/O)

>> I don't know about CDC Fortran and asynchronous I/O, though.


> CDC definitely supported asynchronous I/O, though I don't know whether
> it had any relation to the aforementioned DOE spec, which I don't know
> anything about.


> CDC used bufferin/bufferout, which I believe was also used by some other
> vendors, but CDC's is the one I most recall working with.


The IBM form seems to be:

READ(a,ID=n) ...
WRITE(a,ID=n) ...
WAIT(a,ID=n)

Where the ID= value is used to connect the WAIT to the appropriate
READ or WRITE. Unformatted only, and the usual rules on accessing
variables between the READ or WRITE and matching WAIT.
(I don't remember ever doing it, though.)

-- glen
 
Reply With Quote
 
e p chandler
Guest
Posts: n/a
 
      12-30-2010

"luser- -droog" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
On Dec 30, 10:08 am, "e p chandler" <(E-Mail Removed)> wrote:
> > One of the vendors that mentioned the DOE I/O thing was Floating
> > Point Systems. They had fortran (cross-) compilers for their
> > hardware that did support true asynchronous i/o (i.e. not just the
> > syntax). I forget who the other vendor was, but it could have been
> > CDC or ETA (which were the same company for a while). DOE labs at
> > that time had a pretty wide range of hardware, including machines
> > from IBM, Cray, DEC, FPS, Convex, SCS (a minicomputer based on Cray
> > architecture), Alliant, CDC, and ETA. There were probably others,
> > these where the ones that I worried about with my codes.

>
> > It is kind of interesting that none of these mainframe/supercomputer
> > class machines were based on the x86 intel architecture, isn't it?

>
> [OT] Huh? The 8086 was a 16 bit bus version of the 8088. The 8088 came
> from
> the 8080, the 8080 from the 8008 and the 8008 from the 4004. The 4004 was
> designed to do 4 bit (BCD) arithmetic inside a Japanese calculator. I
> remember seeing a 4004 based computer design inside a university EE lab
> back
> in 1972.


So all the BCD instructions are still there for backward
compatability?? Is there a Vista compatability wizard for
all that legacy 4004 code?

--


The 80x86 took one approach to (unsigned) packed BCD. It uses decimal adjust
instructions. The 65xx has a separate decimal mode which is invoked before
doing packed BCD. So one way to convert binary to BCD on the 65xx is to
shift bits left into carry, then add a two byte set of z-page locations to
itself in BCD (in decimal mode).
Relevance to later architectures? IIRC microcode on early 360 systems
actually worked on 8 bit bytes.




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Re: How to check whether malloc has allocated memory properly in caseif malloc(0) can return valid pointer Gene C Programming 0 12-20-2010 05:33 AM
Dynamically Allocated Memory vs. Statically allocated Memory csnerd@gmail.com C++ 5 12-09-2004 01:44 AM
Malloc/Free - freeing memory allocated by malloc Peter C Programming 34 10-22-2004 10:23 AM
some queries on freeing memory allocated using malloc Hassan Iqbal C Programming 3 09-25-2003 02:53 PM



Advertisments