A C Adventure: your comments are welcome

S

spinoza1111

spinoza1111said:







Right. The above is an intelligent comment.


You are free to ask me to leave this newsgroup, and I am free to laugh
at the idea of meeting your request. The remark I made was a
technical remark, intended to facilitate your repairing at least one
code problem prior to compilation. It appears you are incapable of
receiving help graciously. Prove me wrong.

You're mostly incapable of giving help graciously.
 
B

Beej Jorgensen

spinoza1111 said:
#include "stdafx.h"
using namespace System;

If you get rid of those two lines, it compiles under gcc in C99 mode,
too, with -Wall -pedantic, even.
(*ptrNewNode).uintSegmentLength = uintSegmentLength;

Use the -> operator--it's generally agreed to be much clearer.

-Beej
 
S

spinoza1111

I'd be very grateful if you would remove any reference to my name from
the source.  Thank you.

<snip code>
It is hard to comment on because we can't assume that any of the
identifiers mean what they seem to mean.  At least that is how I read
the conclusion in another thread.

Your problem is that you refuse to admit that there is a large region
of "transgressive potential" in the C community, and that this region
is active behind the scenes.

Following Knuth's definition of a programming language as a language
for communicating intention as to how to use computers between human
beings, C IS the C community in a strong sense.

The claim of Heathfield et al. being that "if you do not transgress, C
is a usable programming language". The argument for this claim is that
"all languages allow transgression, and C is no different".

However, this is falsified IF there is in fact transgression going on
using the wider facilities of C for transgression...including aliasing
and the preprocessor.

My experience is that this is so. To "meet deadlines" and "get a job
done", "expert" C programmers more or less have to violate their own
self-imposed rules to a greater degree than C Sharp and Java
programmers. Real C code in contrast to examples in standards manuals
is transgressive, with hard coded limits and failures to accomodate
problems.

This means that any given C programmer can be at any time exposed, and
whether he is depends on political factors as in the case of Herb
Schildt who fell foul of Microsoft hatred.

I conclude that we need a safer and slower language in order to better
accomplish the REAL goal, which is Knuth's communicating our
intentions as to way we intend to use computers to other people.
Ideally, a program would be a message to an end user or other
stakeholder that has the side-effect of making the computer do stuff.
And ideally, "professional programming" would cease to exist.
 
D

Dennis

spinoza1111 said:
Here is the program, which now compiles with no errors or warnings
using Microsoft C++ .Net Express. The next step is to add functions to
print and inspect ropes, although I do not need heavy instrumentation
since Microsoft C++ Express provides a debugger.

Although I am using a C++ compiler, this code is C. Later on I will
use Navia and another free C compiler to verify that I have not used C+
+ features unintentionally.
// cStringsCPP.cpp : main project file.

If you use a .c extension, MSVC++ will compile the proigram as a C language
program.
At least, thbat's what the professional version does.
Should be similar for Express.

<snip>

Dennis
 
S

spinoza1111

If you use a .c extension, MSVC++ will compile the proigram as a C language
program.
At least, thbat's what the professional version does.
Should be similar for Express.

<snip>

Dennis

Thanks...back to the drawing board. The program code above compiled
successfully as a C++ program. It now needs to compile as a C program
this being comp.lang.c.
 
P

Phil Carmody

Beej Jorgensen said:
If you get rid of those two lines, it compiles under gcc in C99 mode,

Beej, why are you still feeding the troll? If you're too dense
to detect how you've been so amateurishly hooked, can I recommend
you take a few weeks' break from the group to collect yourself?

Phil
 
S

spinoza1111

If you get rid of those two lines, it compiles under gcc in C99 mode,
too, with -Wall -pedantic, even.

OK, the C++ compiler doesn't "do" C99. Let's see, I hate C99. This
means I have to continue to work on getting the code to compile with C+
+ .Net which appears to be C99-negative (unless there is an option),
but as a .C program.

Surely there must be a dialect of perfect, minimal C which worketh on
all compilers including C++ compilers.

Fun stuff, thanks for the information. No, Mister Jones, I don't want
the Kool Ade.
 
S

spinoza1111

Beej, why are you still feeding the troll? If you're too dense
to detect how you've been so amateurishly hooked, can I recommend
you take a few weeks' break from the group to collect yourself?

"Beej, why are you talking to the dirty Jew?"

"Trolling" is posting insincerely to "get a rise" out of people,
ASSHOLE. I am re-learning C in order to best criticise it by writing
an application, and I have asked for assistance here in comp.lang.c. I
have invited people, in good faith and with sincerity, to contribute,
and where they have contributed, I have credited them, and where they
have asked not to be credited, I have removed them. I have, for
example, credited Richard Heathfield who is NOT my friend at all.

Your use of "troll" derives from Nordic racism of Indo-European
peoples vis a vis aboriginal Europeans, and it is grammatically
isomorphic, ASSHOLE, to anti-semitic texts. YOU are trolling this
discussion. Get out if you cannot stick to the topic.

Read Heathfield's posts for an example of how minimally to conduct
yourself here if you hate my guts. He doesn't like me and I don't like
him, but he accuses me (wrongly) of incompetence, not being able to
recognize competence when competence scales up, and of being a
sociologist rather than a programmer. He has said that I'm not a troll
and if you credit him, stop these insane accusations that I am
trolling.

Asshole. And if you don't like "profanity", too bad. I'd rather you
told me to get fucked than use crypto-racist language which makes you
sound like Hitler as Godwin converges to unity.
 
N

Nick Keighley

microsoftism. You shouldn't need if if you are writing a bog
standard console program

C++ism. I'm not even sure what namespace System is! I don't
think it's even standard C++.
OK, the C++ compiler

there is no such thing as "the C++ compiler". Do you mean Microsoft's
Visual C++ said:
doesn't "do" C99.

MS don't support C99 (and I don't believe they have any intention of
doing so)
Let's see, I hate C99.

hatred leads to anger leads to the dark side
This
means I have to continue to work on getting the code to compile with C+
+ .Net which appears to be C99-negative (unless there is an option),
but as a .C program.

try specifing .c (lower case c) becuse MS's compiler should be able
to operate in a pure (C89) mode.
Surely there must be a dialect of perfect, minimal C which worketh on
all compilers

the nearest you can get is C89. MS do it. gcc do it. Navia-C is closer
to
c99 than c89. But this mostly means you just don't use certain
features.
At this stage MS's compiler invoked as a C compiler is probably your
best option. I use it and like it (just so you know not everyone hates
MS!).
including C++ compilers.

C++ is not C. There is a large intersection but I'm not sure it's
worth
your while trying to hit it.


you're at least the 3rd person to tell him this...
 
N

Nick Keighley

John Bode said:
What compiler has Schildt written[?]
Tiny C.
Interesting.  Did not know that.
Neither did I, and I still don't. I await independent verification of
the fact. I can see no mention of Schildt's name on the Tiny C Web
site.
I am aware that Schildt /attempted/ to write an /interpreter/ for a
/subset/ of C.

[...] It's impossible to write an interpreter
without writing the front end of a compiler.

depends what you are interpreting. But you are going to have to write
some sort of parser if you are interpreting C.

Writing interpreters for tiny subsets of languages isn't hard.
I've no idea how much of C Little C represented
 
N

Nick Keighley

Nevertheless, an interpreter is not a compiler.

I'm sure we could blur the interpreter/compiler distinction if we
wanted
to. The Standard itself uses the neutral term "translation".


- pure I. Every line is parsed and exectuted at run time
- parse and save a tokenised form. Interpret that.
- compile to byte-code. Interpret that.
- compile to machine code. Execute machine code on an emulator.
- compile to machine code. Execute on micro-coded hardware.
- compile to machine code. Execute on sea-of-gates hardware.

- compile to some other HLL (eg. C++ used to compile to C)
 
J

James Kuyper

Nick said:
C++ is not C. There is a large intersection but I'm not sure it's
worth
your while trying to hit it.

There's a lot of obscure special cases (see Annex C. of the C++ standard
for a comprehensive listing of C90 features that differ in meaning or
legality from C++) but it's not particularly difficult to avoid them;
mostly the differences consist of taking code that is legal in C, but a
bad idea, and making it illegal in C++. The main exception is that
relying upon the implicit conversions of void* pointers is a good idea
in C, and illegal in C++. I believe that any strictly conforming C
program can be modified to have the same required behavior as the
original when compiled as a C program, and to also have the same
required behavior when compiled as a C++ program.
 
S

spinoza1111

spinoza1111said:



Please remove my attribution. I have no desire to be associated with
your code.

Done. And I see you need to grow up too.
Phil Carmody has just as much right to post material you don't like as
you do to post material he doesn't like. And, of course, you have the
right to ask him not to post certain kinds of material, just as he
has the right to ask others not to post certain kinds of material.
You are allowed to say "Get out" to him, but he doesn't have to pay
any attention to you - and he won't. So why bother? Saying "get out"
just makes you look intolerant.

If we can say anything and have it all flattened out and equated,
there's really no point in saying anything. When I make a case, I set
out to destroy your huts and take your women in the metaphorical
register, because our ability to make a vigorous case is all that
separates us from the Hobbesian war of all against all.
It is true that you would not be my first choice for a party
invitation, but I don't hate you (or anyone); "doesn't like" is a
fair description, however.

Don't deny your anger.
I can tell.


Objectivity about one's own achievements is impossible to acquire, and
so we are wise to look to the opinions of others who are
knowledgeable in our field if we desire to gain a fair understanding
of our own competence. You are, as far as I'm aware, the *only*
person here who actually feels obliged to claim competence for
themselves.

I am afraid that this is so. Frankly, I think that only rather
marginal people come here, most of them marginal because of low
competence. I come here marginalized by an unusual professional
trajectory.

When I find someone smarter than myself, as opposed to someone more
knowledgeable about the details of a technology as you are, for now,
in C, I will let you know.

I do think that when competence scales up, it is called
"incompetence". For example, many programmers deficient in English
actually believe that literate comments show incompetence. It is true
that on occasion, overly verbose comments indicate an attempt to
explain away problems, but normally this type of language is ill or a
literate.
 
S

spinoza1111

spinoza1111said:







Nevertheless, an interpreter is not a compiler.


I asked for independent verification of a claim that turns out to be
false. How is that "destroying people"? Surely any destruction should
be laid at the door of those who made false claims about Schildt (in
this case, the apparently claim that he wrote a compiler).

"One of Schildt's most enduring projects is the Little C interpreter,
which is a lengthy example of a hand-written recursive-descent parser
which interprets a subset of the C language. The program was
originally published in Dr. Dobb's Journal in August, 1989 entitled
"Building your own C interpreter". This example was included in the
book Born to Code In C (Osborne, 1989) and in a later edition of C:
The Complete Reference."

If you don't believe wikipedia, track down the references. Above all
STOP this business of innuendo and personal destruction by posting
lies about people.
 
N

Nick Keighley

There's a lot of obscure special cases (see Annex C. of the C++ standard
for a comprehensive listing of C90 features that differ in meaning or
legality from C++) but it's not particularly difficult to avoid them;
mostly the differences consist of taking code that is legal in C, but a
bad idea, and making it illegal in C++. The main exception is that
relying upon the implicit conversions of void* pointers is a good idea
in C, and illegal in C++. I believe that any strictly conforming C
program can be modified to have the same required behavior as the
original when compiled as a C program, and to also have the same
required behavior when compiled as a C++ program.

That was intended to be "it's not worth *spinoza's* while to try and
hit
it". Without reasonable knowledge of both C and C++ he won't be able
to
do it without some sort of automatic verification which pretty much
means compiling it for both C and C++. Which seems like unnecessary
pain. The same applies to C89/C99. Since he wants to avoid C99 I'd
say he was better off with MS's compiler than lcc-win32 as MS are
nearly
C89 whilst lcc-win32 doens't have a C89 mode.
 
J

James Kuyper

Nick said:
That was intended to be "it's not worth *spinoza's* while to try and
hit
it".

OK, I didn't realize that the "you" was meant to be personal rather than
generic. I'm in full agreement with you on that one. To know how to
avoid the conflicts between C and C++ he would first have to learn
enough C to be able to understand the description of those conflicts,
and from what I've seen he's got a long way to go (and what may be the
worst possible motivation for trying to go there).
... Without reasonable knowledge of both C and C++ he won't be able
to
do it without some sort of automatic verification which pretty much
means compiling it for both C and C++. ...

Compiling it in both languages will help, since many of the differences
involve code for which a diagnostic is mandatory in one of the two
languages, and not in the other. However, there are a few differences
where that's not the case. Most notably, the value of sizeof 'a' and the
linkage of a file-scope declaration of "const int pi=3;" are different
in the two languages.
 
D

Dik T. Winter

....
> There are Two Cultures in computing. Having been in both, I find that
> the most intolerant people are on the DEC/C/Web/Java/unix side, not
> the IBM or Microsoft side.

Strange as it may seem, I do not come from either the DEC, C, Web, Java or
unix side. For me C is about the fifth programming language I did (after
Algol 60, Fortran, Pascal and Algol 68 in that order). But I needed C when
in about 1982 when I had to write programs on our Vax running Unix. The
computer I started with (in 1968) was an Electrologica X8 (which used the
semaphores that Dijkstra had just discovered).
 
S

spinoza1111

That was intended to be "it's not worth *spinoza's* while to try and
hit
it". Without reasonable knowledge of both C and C++ he won't be able

Part of what I am showing (by working one hour a day on my commute) is
that programmers exagerrate the difficulty of learning, or in my case
re-learning, a programming language as opposed to learning programming
in the abstract. One reason I was asked to teach C at Princeton in
1991 was that the university didn't regard C as an academic subject.

The exagerrated reverence accorded to knowing the details of a
programming language is mocked by Harry Braverman in his book on the
realities of white-collar employment, "Labor and Monopoly Capital",
and I for one have nothing to lose in exposing the hollowness of what
passes for "knowledge" here.

But I will admit that I've hardly ever used C++. Looks like I was by
accident, but that's been fixed: see below.
 
S

spinoza1111

OK, I didn't realize that the "you" was meant to be personal rather than
generic. I'm in full agreement with you on that one. To know how to
avoid the conflicts between C and C++ he would first have to learn
enough C to be able to understand the description of those conflicts,
and from what I've seen he's got a long way to go (and what may be the
worst possible motivation for trying to go there).


Compiling it in both languages will help, since many of the differences
involve code for which a diagnostic is mandatory in one of the two
languages, and not in the other. However, there are a few differences
where that's not the case. Most notably, the value of sizeof 'a' and the
linkage of a file-scope declaration of "const int pi=3;" are different
in the two languages.- Hide quoted text -

- Show quoted text -

I fixed the project to be a C project. I had to make some minor
changes to the code to get to pre-C99 C: mostly just moving a few
variables to the beginning of their procedure.

Here is the C code.

// ***************************************************************
// * *
// * Rope implementation *
// * *
// * This program implements strings, called ropes, which can *
// * contain any character and can be of any length. *
// * *
// * This code is best viewed using a monospace font such as *
// * Courier New, in a line length of 67 characters. *
// * *
// * The rest of this header addresses these topics: *
// * *
// * *
// * * The "rope" as represented in this code *
// * * Configuring this code for testing *
// * *
// * *
// * Note that the contributions of two anonymous usenet posters *
// * are acknowledged with a grace they have failed to show. *
// * *
// * *
// * THE "ROPE" AS REPRESENTED IN THIS CODE -------------------- *
// * *
// * The rope is defined as the binary tree of its nodes, where *
// * each node points to up to SEGMENT_MAX_LENGTH characters of *
// * the string. Each node of the binary tree contains: *
// * *
// * *
// * * A pointer to the start of the segment *
// * *
// * * The node type: *
// * *
// * + ENUnodeType.child indicates that the node is a *
// * child node of another node. *
// * *
// * + ENUnodeType.ancestor indicates that the node is *
// * not a child of another node *
// * *
// * * The node length type: *
// * *
// * + ENUnodeLengthType.known indicates that the length *
// * (of the ancestor's complete string or the child *
// * subtree's substring) is known *
// * *
// * + ENUnodeLengthType.tooLarge indicates that the *
// * length exceeds the maximum value and is unknown. *
// * *
// * By default, this maximum value is 2^63-1, the *
// * maximum length of an unsigned "long long" less a *
// * margin to allow for testing the length. The *
// * maximum value, however, can be set to smaller *
// * values for testing. *
// * *
// * * The 64 bit unsigned string length. Note that this *
// * value may be unusable because the length may exceed *
// * the max value: here the node length type will be *
// * ENUnodeLengthType.unknown. *
// * *
// * * The start index of the rope segment (substring) *
// * within the full string; note that in rare cases this*
// * is unknown when the string is longer than 2^64-1 *
// * characters, and the segment is located on the right *
// * of the string, this value may also be unknown. Here *
// * it is set to -1. *
// * *
// * * The length of the rope segment (substring) *
// * *
// * * The address of the parent of the node or NULL *
// * *
// * * The address of the left child of the node (holding *
// * characters to the left of the segment) or NULL *
// * *
// * * The address of the right child of the node (holding *
// * characters to the right of the segment) or NULL *
// * *
// * *
// * CONFIGURING THIS CODE FOR TESTING ------------------------- *
// * *
// * The following symbols may be set to configure a test of this*
// * code. *
// * *
// * *
// * * SEGMENT_MAX_LENGTH: maximum length of a rope string *
// * segment *
// * *
// * * STRING_MAX_RECORDABLE_LENGTH: maximum recordable *
// * length of a string, beyond which the string length *
// * is officially "unknown". *
// * *
// * To test strings whose lengths are not known without *
// * having to generate oodlemegaterabytes of data, this *
// * value can be set to a small value. For actual use, a*
// * recommended value is 2^63-1. *
// * *
// * *
// * C H A N G E R E C O R D --------------------------------- *
// * DATE PROGRAMMER DESCRIPTION OF CHANGE *
// * -------- ---------- --------------------------------- *
// * 08 14 09 Nilges Started version 1 *
// * *
// * 08 18 09 Nilges 1. Revised implementation of *
// * statement macros per *
// * anon. *
// * 2. Using typedef instead of *
// * #define per anon *
// * 3. Using typename in cast in *
// * place of length per anon *
// * *
// * 08 19 09 Nilges Compiles successfully *
// * *
// * 08 19 09 Nilges Converted to pre-C99 C was *
// * actually C++: removed .Net stuff, *
// * moved variable decls to start of *
// * functions (yecchhh...) *
// * *
// * I S S U E S ----------------------------------------------- *
// * DATE POSTER DESCRIPTION AND RESOLUTION *
// * -------- ---------- --------------------------------- *
// * 08 18 09 Nilges To be implemented: rope names and *
// * Dewey decimal numbers of rope *
// * nodes. Routines for inspection and*
// * display of ropes. Code *
// * instrumentation of debug displays.*
// * *
// * 08 14 09 Nilges To be implemented: use extra *
// * precision arithmetic for unbounded*
// * strings, representing big nums as *
// * big strings but in a big base such*
// * as 256 for chars & 32768 for *
// * wchars. *
// * *
// * *
// * ----------------------------------------------------------- *
// * *
// * The scientific industry has its exact counterpart in the *
// * kind of minds it harnesses: they no longer need to do *
// * themselves any violence in becoming their own voluntary and *
// * zealous overseers. Even if they show themselves, outside *
// * their official capacity, to be quite human and sensible *
// * beings, they are paralysed by pathic stupidity the moment *
// * they begin to think professionally. *
// * *
// * - T. W. Adorno, Minima Moralia, 1948 *
// * *
// * *
// ***************************************************************

// ***** Standard includes ***************************************

#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <stddef.h>

// ***** Configuration *******************************************

#define SEGMENT_MAX_LENGTH 32
#define STRING_MAX_RECORDABLE_LENGTH 1024 // Set to 2^63-1 for
// actual use
#define UNKNOWN_START_INDEX -1

// ***** Macros **************************************************
// * *
// * Macros are of two types: *
// * *
// * *
// * * Statement macros can be used anywhere a C statement *
// * is valid. They are surrounded by curly braces, prefixed*
// * with do, and suffixed with while(0). When used, *
// * statement macros must be followed with a semicolon. *
// * Their names are suffixed with _STMT. *
// * *
// * * Expression macros can be used anywhere a C expression *
// * is valid. Their definitions are surrounded by round *
// * parentheses. Their names are suffixed with _EXP. *
// * *
// * *
// ***************************************************************
// --- Statement macro to handle errors
#define ERRORHANDLER_STMT(strMessage) \
do { \
printf("%s\n", (strMessage)); abort(); \
} while(0)

// --- Expression macro to return smaller value
#define MIN_EXP(value1, value2) \
( (value1) < (value2) ? (value1) : (value2) )

// --- Expression macro to perform malloc
#define MALLOC_EXP(typeName, mallocSize) \
( (typeName)(malloc(mallocSize)) )

// --- Statement macros to perform malloc with error checking
// Allocate using a type
#define MALLOCTYPE_STMT(ptr, mallocType, mallocPurpose) \
do { \
MALLOCSIZE_STMT(ptr, \
mallocType, \
sizeof(mallocType), \
mallocPurpose); \
} while(0)
// Allocate using a size
#define MALLOCSIZE_STMT(ptr, \
mallocType, \
mallocSize, \
mallocPurpose) \
do { \
if (((ptr) = MALLOC_EXP(mallocType, mallocSize)) \
== \
NULL) \
{ \
printf \
("Can't get %d bytes of storage\n", (mallocSize)); \
printf \
("My purpose was: %s...sorry it didn't work out\n", \
(mallocPurpose)); \
ERRORHANDLER_STMT("Malloc failed"); \
} \
} while(0)

// ***** Rope definition *****************************************

enum ENUnodeType { child, ancestor };

enum ENUnodeLengthType
{
known, tooLarge
};

typedef struct TYPropeNode ROPE;
typedef ROPE * Rope;

struct TYPropeNode
{
enum ENUnodeType enuNodeType;
enum ENUnodeLengthType enuNodeLengthType;
char * ptrNodeCharacters;
unsigned long long ulngStringLength;
unsigned long long lngSegmentStartIndex;
unsigned int uintSegmentLength;
Rope ptrParent;
Rope ptrLeft;
Rope ptrRight;
};

// ***** Procedures **********************************************

// ---------------------------------------------------------------
// Create a rope node
//
//
Rope mkRopeNode
(char * ptrNodeCharacters,
long long lngSegmentStartIndex,
unsigned int uintSegmentLength,
Rope ptrParent,
Rope ptrLeft,
Rope ptrRight)
{
Rope ptrNewNode = (Rope)NULL;
MALLOCTYPE_STMT(ptrNewNode, Rope, "Allocate a rope node");
(*ptrNewNode).ptrNodeCharacters = ptrNodeCharacters;
(*ptrNewNode).enuNodeType =
ptrParent == NULL
?
ancestor
:
child;
(*ptrNewNode).lngSegmentStartIndex = lngSegmentStartIndex;
(*ptrNewNode).uintSegmentLength = uintSegmentLength;
(*ptrNewNode).ptrParent = ptrParent;
(*ptrNewNode).ptrLeft = ptrLeft;
(*ptrNewNode).ptrRight = ptrRight;
(*ptrNewNode).ulngStringLength =
uintSegmentLength
+
(ptrLeft != NULL ? (*ptrLeft).ulngStringLength : 0)
+
(ptrRight != NULL ? (*ptrRight).ulngStringLength : 0);
return ptrNewNode;
}

// ---------------------------------------------------------------
// Calculate next start index on behalf of mkRope()
//
//
long long mkRope_calcStartIndex(long long lngOld,
unsigned int uintOffset)
{
unsigned long long ulngNew;
if (lngOld == UNKNOWN_START_INDEX) return UNKNOWN_START_INDEX;
ulngNew = lngOld + uintOffset;
if (ulngNew <= STRING_MAX_RECORDABLE_LENGTH)
return (long long)ulngNew;
return UNKNOWN_START_INDEX;
}

// ---------------------------------------------------------------
// Make rope
//
//
Rope mkRope
(Rope ptrParent,
char * ptrSourceChars,
long long lngStartIndex,
unsigned long long ulngStringLength)
{
Rope ptrRopeNode;
Rope ptrLeft;
Rope ptrRight;
unsigned int uintNodes;
unsigned int uintDoubleSegmentLength;
ptrLeft = NULL; ptrRight = NULL;
if (ulngStringLength <= SEGMENT_MAX_LENGTH)
uintNodes = 1;
else
{
if (ulngStringLength
<=
(uintDoubleSegmentLength = SEGMENT_MAX_LENGTH << 1))
uintNodes = 2;
else
uintNodes = 3;
}
ptrRopeNode =
mkRopeNode
(// ----- Pointer to source chars -----------------------
(uintNodes > 1
?
ptrSourceChars + SEGMENT_MAX_LENGTH
:
ptrSourceChars),
// ----- Parent segment start index --------------------
(mkRope_calcStartIndex
(lngStartIndex,
uintNodes > 1 ? SEGMENT_MAX_LENGTH : 0)),
// ----- Parent segment length (screw you anon) --------
(unsigned int)
(uintNodes > 1
?
MIN_EXP((ulngStringLength - SEGMENT_MAX_LENGTH),
(SEGMENT_MAX_LENGTH))
:
ulngStringLength),
// ----- Parent's own parent or null -------------------
ptrParent,
// ----- Left child node exists when segments > 1 ------
(uintNodes > 1
?
(ptrLeft = mkRopeNode
(ptrSourceChars,
lngStartIndex,
SEGMENT_MAX_LENGTH,
NULL, NULL, NULL))
:
NULL),
// ----- Right child node exists when segments > 1 ----
(uintNodes > 2
?
(ptrRight = mkRope
(NULL,
ptrSourceChars
+
uintDoubleSegmentLength,
mkRope_calcStartIndex
(lngStartIndex, uintDoubleSegmentLength),
SEGMENT_MAX_LENGTH
-
uintDoubleSegmentLength))
:
NULL));
if (ptrRopeNode != NULL)
{
(*ptrRopeNode).ptrLeft = ptrLeft;
(*ptrRopeNode).ptrRight = ptrRight;
if (ptrLeft != NULL)
(*((*ptrRopeNode).ptrLeft)).ptrParent =
ptrRopeNode;
if (ptrRight != NULL)
(*((*ptrRopeNode).ptrRight)).ptrParent =
ptrRopeNode;
(*ptrRopeNode).ulngStringLength = ulngStringLength;
}
return ptrRopeNode;
}

int main()
{
printf("Unlimited strings in basic C");
// ***** Insert test code *****
return 0;
}
 
S

spinoza1111

 > > ...
 > >  > Oh, blow me. I was formatting code beautifully in 1971, using punche=
 > d
 > >  > bloody cards. What were you doing in 1971?
 > >
 > > Oh well, at that time I was formatting beautifully in 1971, using punched
 > > bloody tape.  So, no line numbers at the end...
...
 > There are Two Cultures in computing. Having been in both, I find that
 > the most intolerant people are on the DEC/C/Web/Java/unix side, not
 > the IBM or Microsoft side.

Strange as it may seem, I do not come from either the DEC, C, Web, Java or
unix side.  For me C is about the fifth programming language I did (after
Algol 60, Fortran, Pascal and Algol 68 in that order).  But I needed C when
in about 1982 when I had to write programs on our Vax running Unix.  The
computer I started with (in 1968) was an Electrologica X8 (which used the
semaphores that Dijkstra had just discovered).

You're from an older culture where the praxis was more unified. Lucky
you.

What was coding in Algol 68 like?
 

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

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top