From: Craig Powers on
Larry__Weiss wrote:
> Craig Powers wrote:
>> It's not quite as concise as With, but there is Associate in F2003
>> that lets you create an alias for a variable or expression IIRC.
> >
>
> I looked it up, and it seems like a C preprocessor macro defined
> with local scope. Am I missing anything subtle about it?

I believe so -- a preprocessor macro performs a naive substitution, such
that if the substituted bit is an expression, the expression will be
evaluated multiple times (something that can cause subtle bugs in C and
C++ programs). I don't think there is a direct analog in C or C++,
although a C++ reference captures some of the capabilities.
From: Brian Inglis on
fOn Fri, 20 Oct 2006 18:47:21 +0000 (UTC) in alt.folklore.computers,
glen herrmannsfeldt <gah(a)seniti.ugcs.caltech.edu> wrote:

>In comp.lang.fortran Larry__Weiss <lfw(a)airmail.net> wrote:
>
>> I hesitate to ask, but does modern Fortran have that something
>> similar to the nestable "With" type of block that Pascal and
>> VB have?
>
>Not exactly the same, but WITH always reminded me of
>structure assignment that PL/I has, but many other languages don't.
>
>ANSI C allows passing structures as function arguments, but
>won't do a simple structure assignment. K&R C only allowed
>pointers to structures to be passed to functions.

C89 says:
"6.3.16.1 Simple Assignment
Constraints
....
-- the left operand has a qualified or unqualified version of a
structure or union type compatible with the type of the right;"

so structures and unions can be passed as arguments to and returned as
results from functions and assigned e.g.
struct t v1, v2 = { 0 }; v1 = f( v2 );
is valid.

--
Thanks. Take care, Brian Inglis Calgary, Alberta, Canada

Brian.Inglis(a)CSi.com (Brian[dot]Inglis{at}SystematicSW[dot]ab[dot]ca)
fake address use address above to reply
From: glen herrmannsfeldt on
In comp.lang.fortran Brian Inglis <Brian.Inglis(a)systematicsw.invalid> wrote:
(snip on structure expressions)

> C89 says:
> "6.3.16.1 Simple Assignment
> Constraints

> -- the left operand has a qualified or unqualified version of a
> structure or union type compatible with the type of the right;"

> so structures and unions can be passed as arguments to and returned as
> results from functions and assigned e.g.
> struct t v1, v2 = { 0 }; v1 = f( v2 );
> is valid.

But nothing more than that.

You can't use a struct with any other operators.
You can't assign a scalar expression, or even a constant to
a struct.

v1=0;
v1=v2+1;
v1=v2+v2;

Anything other than v1=v2; or v1=f(v2); doesn't work (at least in C90).

-- glen

From: Richard Steiner on
Here in alt.folklore.computers,
nospam(a)see.signature (Richard Maine) spake unto us, saying:

><jmfbahciv(a)aol.com> wrote:
>
>> Yes that is a problem. One way to avoid that is to design
>> your naming procedures to ensure exlclusivity. This is not
>> difficult.
>
>It wasn't so easy in the days of 6-character name length limits. It was
>hard enough to do comprehensible names without special conventions for
>uniqueness.

Not that hard, actually. You simply adopt a logical naming procedure
for variables and source files.

We used to (and still) assume that all 6-character identifiers were
external in nature (that is, were DEFINEs or PARAMETERs located in an
external file (named SOMETHING-F) which was later INCLUDED by programs
that wanted to use that set of definitions.

All local variables were either five characters or one character (the
latter was reserved for local loop counters only and was usually I, J,
K, etc.).

For external parameters/defines, we tend to use the USAS convention of
using the first two characters for the filename and the last four for
the variable itself. This works well because USAS freespace files tend
to have two-character names.

Thus, the length of the file AP would be something like APLGTH or maybe
APFLEN, an IATA city code stored in AP would be APCITY, etc. We try to
be fairly consistent across different files in our applications, so a
record length is always xxLGTH regardless of file, etc.

At NWA, using a non-USAS environment, we tended to use the following
conventions:

(1) The first two characters were always the two-character application
code (e.g., "WX" for weather, "GW" for Gross Weights, etc.).

(2) The third letter tended to be unique for each file the define or
parameter was being used for.

This way, one knew that "WXSxxx" was always a define of a data element
inside the Weather Station File, "WXGxxx" was always a define of a data
element inside the Weather Grid file, etc. Thus, the length of the
Weather Grid file would be WXGLEN, the time stored for a METAR in the
WX Station file might be WXSTIM and its text might be WXSTXT, etc.

I've worked with the 6-character limit since 1988, and I still find it
easier to read the variable names in those older FORTRAN programs than
I do in the newer C++ code I have to support because the FORTRAN folks
were *far* more disciplined in their variable naming conventions.

--
-Rich Steiner >>>---> http://www.visi.com/~rsteiner >>>---> Mableton, GA USA
Mainframe/Unix bit twiddler by day, OS/2+Linux+DOS hobbyist by night.
WARNING: I've seen FIELDATA FORTRAN V and I know how to use it!
The Theorem Theorem: If If, Then Then.
From: glen herrmannsfeldt on
Rostyslaw J. Lewyckyj wrote:
(snip)

> I can only offer my own opinion formed on general principles and
> experience at the University of NC research computing facilities.
> At DEC your shop was obviously different with a different mix
> of skill levels. Generally we keyed in our own programs. Rarely
> were they written out on coding forms.

That sounds like all scientific research labs I ever saw.

(snip)

> The i/o clerks were student help hired because they were available
> for the given hours, and not for any knowledge.
> They might be into programming or not. They came to us looking
> for work on word of mouth recommendations of friends, because
> they saw the i/o clerks when they submitted their own decks,
> etc. The recriminations were of the type "I want a $$ credit
> for this failed job because joe at the output window suggested
> that I do this ..."

I once asked for credit for a job that failed due to
a Machine Check error. That is the interrupt when the
machine decides it isn't right. Interestingly it didn't
seem to go down, or abend anyone else at that time.

-- glen