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

  • Thread starter Shivanand Kadwadkar
  • Start date
S

Sjouke Burry

glen said:
Before SUBROUTINE, FUNCTION, and CALL, subroutines were done
using GOTO and ASSIGNed GOTO. To allow for such within a DO loop,
one was allowed to GOTO out of a DO loop, do something else, and
then GOTO back again.

I believe that has been removed in newer versions of the
standard.

-- glen
I have used the jump out/jump back for quite a long time, because
loop depth was rather limited,(about 7 as I remember) and the
compiler quit when to deep.
Jumping out and execute some of the inner loops just before the
end statement, then go back, escaped the attention of the compiler,
and produced no errors. Problem solved(QUITE DIRTY).
 
G

glen herrmannsfeldt

Yes, this was really the point that I was trying to make before. I
think most programmers up through the 70's (in the US, that was my
only experience at the time) only worked on a single machine. It
might have been an IBM shop, or a Univac shop, or a CDC shop, or
whatever, but that was the hardware that was available to a single
programmer, and his job was to squeeze everything out of it that he
could for his set of applications. That often meant using
machine-specific extensions for things like bit operators, or access
to some hardware widget or i/o device, or operations on character
strings, and so on. Given the choice between slow portable code or
fast machine-specific code, the pressure always seemed to be toward
the latter.

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.)

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.

I do remember having a friend try to compile it using the NCR
Century 100 Fortran compiler, but don't remember if it ever compiled.

It might be that NCR implements Standard Basic FORTRAN, a subset
defined in the standard.

-- glen
 
R

Ron Shepard

glen herrmannsfeldt said:
I would expect anything DOE related to follow one or the other.
(And note that DOE didn't exist before 1974.)

The date for the DOE was October 1, 1977. It was the beginning of
the first fiscal year after Carter became president. The labs all
existed before that, of course, they dated back to WWII and the
Manhattan project, but they were under control of various other
organizations that were not at the cabinet level, such as the Atomic
Energy Commission (AEC) and the Nuclear Regulatory Commission (NRC).

http://www.energy.gov/about/origins.htm

When the DOE was formed, partly as a response to the OPEC oil
embargo in 1972, energy policy was considered the "moral equivalent
of war". Now it is not just the "moral equivalent", we are actually
fighting wars over energy supply, but there were a few decades in
between.

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?

$.02 -Ron Shepard
 
G

glen herrmannsfeldt

The date for the DOE was October 1, 1977. It was the beginning of
the first fiscal year after Carter became president.

Yes, just after I posted I remembered, it was 1974 that was the
end of AEC, and the beginning of ERDA. AEC was 1947-1974, switch
the digits around, easy to remember.
The labs all
existed before that, of course, they dated back to WWII and the
Manhattan project, but they were under control of various other
organizations that were not at the cabinet level, such as the Atomic
Energy Commission (AEC) and the Nuclear Regulatory Commission (NRC).
When the DOE was formed, partly as a response to the OPEC oil
embargo in 1972, energy policy was considered the "moral equivalent
of war". Now it is not just the "moral equivalent", we are actually
fighting wars over energy supply, but there were a few decades in
between.
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.

Yes, there were a number of smaller machines, but it seems to
me that each lab had either large IBM machines, or large CDC machines
(and later Cray) at the top. I don't remember any with both,
though I wasn't especially trying to keep track. Smaller machines
like VAX were pretty popular all around.
It is kind of interesting that none of these mainframe/supercomputer
class machines were based on the x86 intel architecture, isn't it?

There was iPSC, though it was never very popular. The fifth choice
in the wikipedia disambiguation page for IPSC.

Not so much later they went to the 860 for such machines.

-- glen
 
N

nmm1

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!
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!

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 :)

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


Regards,
Nick Maclaren.
 
N

nmm1

It doesn't, and I didn't say that it does. NIST, for example, is not a
government agency. It does require some kind of recognized organization.
Sure, one can use the word more generically, but it then is sort of
meaningless and everyone can claim that "our version is the standard".

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!

Also, the recognition can be purely de facto - look at MPI for an
example of that - but the MPI Forum isn't a recognised organisation
of any shape or form (except as the 'owner' of the MPI standard!)


Regards,
Nick Maclaren.
 
E

e p chandler

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.
 
R

Richard Maine

glen herrmannsfeldt said:
Well, I don't see that it requires a government agency to make
a standard,

It doesn't, and I didn't say that it does. NIST, for example, is not a
government agency. It does require some kind of recognized organization.
Sure, one can use the word more generically, but it then is sort of
meaningless and everyone can claim that "our version is the standard".

That's sort of like adspeak where everyone claims that their product is
the best. A good example is the way that Verizon's ads like to claim
that their cell network is the most reliable, complete with some
meaningless number for reliability. Verizon objected strongly to the
establishment of any actual standard for defining or measuring
reliability and they don't say what their internal one is. They are just
the best according to their own measurement of their own unspecified
criterion. Yeah, sure.

Or an even better example is the way that I've seen at least one diploma
mill claim to be "accredited". Are they accredited by any regignized
accreditation organization? No. I forget exactly who turned out to be
the source of the "accreditation". Something like the council of indian
tribes of North Carolina? That might not be right, but it was something
along that line; obviously someone willing to be paid for agreeing to
call the diploma mill accredited. Worth about as much as the diplomas,
which mean only that you paid whatever their cost was. Might as well
claim to be accredited by my brother-in-law.

In the case of pre-f66 Fortrans, I don't think you'll find that they
were even claimed to be standards or that people used that terminology.
That's the "nor generally used" part of my quoted statement. Having
someone 50 years later say that it had some of the characteristics of a
standard isn't the same thing.
 
L

luser- -droog

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?
 
R

Richard Maine

Richard Maine said:
It doesn't, and I didn't say that it does. NIST, for example, is not a
government agency. It does require some kind of recognized organization.
Sure, one can use the word more generically, but it then is sort of
meaningless and everyone can claim that "our version is the standard".
[further ranting elided]

Back from breakfast now...

A big reason that abuse of the term "standard" in technical contexts
gets such a reaction from me is to help avoid the term becoming useless
through dilution.

Several years back, one of the regular posters here (a Dave Frank, if I
recall correctly, though I'm not sure if that was his actual name - I
seem to recall some use of pseudonyms) used to insist on using the term
"standard" to mean whatever his current favorite compiler was. He would
give answers about "standard Fortran" to unsuspecting posters, even
posters who had specifically said what other compiler they were using.
When people pointed out that his answers did not reflect the standard,
he would explain that when he said standard he meant <whatever his
current favorite compiler was> and that was a lot better than those
other standards. Might have been ok if he said that up front in his
answers, but instead he just said "the standard" in contexts where you
would never guess what he meant unless you had been a regular reader of
his posts. Occasionally he would capitalize it as "The Standard" for
emphasis.

I found it ironic that <whatever his current favorite compiler was>
changed several times as the vendors stopped making thatparticular
product. But each time he came up with a new definition of "standard
Fortran", which was the only thing anyone should ever use now and
forever (and if they had hardware or operating systems it didn't run on,
they should fix that also).
 
R

Richard Maine

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.
 
R

Richard Maine

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.
 
N

nmm1

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.
 
R

Ron Shepard

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
 
R

Richard Maine

Ron Shepard said:
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).
 
G

glen herrmannsfeldt

In said:
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.
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
 
G

glen herrmannsfeldt

[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
 
G

glen herrmannsfeldt

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
 
E

e p chandler

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,082
Messages
2,570,589
Members
47,212
Latest member
JaydenBail

Latest Threads

Top