home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CPROG
/
C1.ZIP
/
C.A09
Wrap
Text File
|
1989-01-09
|
187KB
|
5,364 lines
=
From: Randall Smith
To: Paul Emmons Msg #2, 03-Jan-89 06:57pm
Subject: Memory Models in .ASM
Paul; I suffered a severe attack of "dumb thumbs" and accidently erased your
original msg and my reply. I once had to link in a third party (large model)
OBJ file to a small model C program. You can use the same approach to solve
your problem. First compile your ASM routines with all far references. Then
create a header (.H) file to force call & references to far. ie.
int far function_name(int far parm1; char * far parm2);
I am not sure the syntax above is correct, I didn't test it. The concept is
sound however. Make sure you #include the header file. This works under
Messy-DOS using TC. Hopes this helps... Later.... Randy.
--- Msg V3.2
* Origin: Point #10 ===> The Mdtn_BBS Point #10 (1:150/511.10)
From: Randall Smith
To: Dan Norstedt Msg #3, 03-Jan-89 07:09pm
Subject: Re: Debugger.
> Most bug hunting aids change the problem from one of
> finding the cause of a bug to making sure the debugger doesn't add (or
> hide) any symtoms (sp?) while the search progresses. Further, most bugs
> can be traced back to their cause without a debugger.
DN>
DN> I would state that their is NO professional programming project today
that
DN> doesn't use a debugger, if one is available. Period.
How about Lotus 123 Version 3.0? <BIG grin> Later... Randy. Lotus 123
Version 3.0 >>someday..
--- Msg V3.2
* Origin: Point #10 ===> The Mdtn_BBS Point #10 (1:150/511.10)
*** There is a reply. See #155.
From: Randall Smith
To: Bob Stout Msg #4, 03-Jan-89 07:25pm
Subject: Common questions--Answered
CD> It seems this question comes up about every 3-4 weeks on the C echo CD>
along with the usual:
CD> 4) (DREADED) Which C compiler is the best?
Bob; 4) "The C compiler you are most familiar with that will get the job you
have to do done"! And Thats the name of that tune! Later....
Randy.
--- Msg V3.2
* Origin: Point #10 ===> The Mdtn_BBS Point #10 (1:150/511.10)
From: Bob Stout
To: Martin Maney Msg #5, 03-Jan-89 04:05am
Subject: HELLO.
> (excerpts from a semilegible photocopy of a list that appears to have
> originated at the University of Waterloo)
Martin...
I'd love to see the rest of the list, legibility notwithstanding!
______________________
/__ __ __ __
__/ / /_/ /_/ /
/_____________________________________
--- msged 1.94S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** There is a reply. See #27.
From: Roland Brown
To: Paul Schlyter Msg #6, 03-Jan-89 02:11pm
Subject: Re: Ctl-C/Break
> In Turbo C 1.0 and 1.5, the signal function is not implemented.
> signal
> was added in Turbo C 2.0, though.
>
No big deal Paul, but I think signal was implemented in 1.5 (agree it was not
in 1.0). Borland changed signal in 2.0 and it works differently, but it was
there in 1.5. Pretty sure but I no longer have the 1.5 manuals - there
somewhere just can't find them in this mess!!
roland
---
* Origin: Sky Pilot Point Mail Box Off 261/1004 (Opus 1:26102/4)
*** There is a reply. See #42.
From: Roland Brown
To: Rod Whitworth Msg #7, 03-Jan-89 02:18pm
Subject: Re: Code Generators
> >
> $459 at Programmers Connection or $635 with the workbench
> source. I have a
> demo which seems to be ok but I don't know how portable
> the generated code is to move to other than messydo. It
> interfaces to Ctree or Cisam or Btrieve or roll your own
> (difficult).
>
A little too rich for my pockets when I can't really see what kind of code it
generates and just how "easy to use it is".
Thanks for the reply anyway.
roland
---
* Origin: Sky Pilot Point Mail Box Off 261/1004 (Opus 1:26102/4)
*** There is a reply. See #8.
From: Roland Brown
To: Daniel Lyke Msg #8, 03-Jan-89 02:20pm
Subject: Re: Code Generators
> a routine to load those screens (either from memory or disk),
> and put in your own data entry routines. It wouldn't be
> as easy as Pro C, nor as complete (Pro C does the database
> call up code and other stuff, I've got the demo disk around
Thanks for the reply.
roland
---
* Origin: Sky Pilot Point Mail Box Off 261/1004 (Opus 1:26102/4)
*** Part of a conversation.
From: Bill Dufault
To: All Msg #9, 02-Jan-89 06:41pm
Subject: Thanks (pointer Problem)
I would just like to thank all of the people who were nice enough to
help me with that pointer problem I was having. Passing the pointers to
POINTERS to pointers worked fine. Thanks again.
Bill
--- RBBSMAIL 17.1C
* Origin: HIPPOCAMPUS - Branford CT (203)481-7475 (RBBSNet 905/4) (RBBS-PC
1:141/205)
From: Malcolm Petcher
To: Betsy Schwartz Msg #10, 02-Jan-89 02:49pm
Subject: VAX C help
Regretably, string descriptors as used in VAX system calls are quite clumsy to
manipulate in C. The descriptor itself is, I believe, a two longword
quantity, with one longword being a pointer to the string, half of the other
longword is the string length, and two more bytes of unknown function. I
don't have my notes on it with me, so can't say exactly what order these are
in. VAX FORTRAN uses exactly this structure for its string descriptors, so if
your installation has the latter language, the easiest thing to do is write
some trivial FORTRAN program that declares a character*n variable, and compile
it with the /list/machine_code options, look at what structure it makes, then
synthesize if in C. Also, don't forget, when passing this in C, use the
ampersand operator, because VAX system services usually expect the address of
the descriptor, not the descriptor itself.
--- ConfMail V4.00
* Origin: Night City (1:124/4102)
From: Malcolm Petcher
To: Mike Housky Msg #11, 02-Jan-89 02:59pm
Subject: Re: Buffer conversion
You can also lock a structure into a predictable memory space by declaring a
union between it and a char array. That forces it to be contiguous, with no
fill characters.
--- ConfMail V4.00
* Origin: Night City (1:124/4102)
*** There is a reply. See #22.
From: Malcolm Petcher
To: Mike Housky Msg #12, 02-Jan-89 03:03pm
Subject: Re: Learning C
Actually, some of the source level debuggers out there today are well worth
using. The VAX debugger is outstanding, though it takes a little preparation
to use effectively. CodeView is likewise powerful, but complicated. One of
the nicest debuggers is the one that comes with MicroSoft Quick C - limited,
but simple. Usually, my first approach, like probably everybodies, is to
stick a few printf's in strategic locations. If that doesn't solve the
problem, and it's time to get out the big guns, you can't beat a source level
debugger.
--- ConfMail V4.00
* Origin: Night City (1:124/4102)
*** There is a reply. See #31.
From: Malcolm Petcher
To: Tom Mcgivern Msg #13, 02-Jan-89 03:12pm
Subject: Re: SUBST, ads
Well, just one more message in the thread. I bought Microsoft FORTRAN 3.3 for
$50, just after 4.0 had come out. Hell of a deal, if you ask me. It's a darn
good version of FORTRAN, even has substrings and most of the optimizations in
4.0. Nothing wrong with offering or buying an old compiler if the price is
right.
--- ConfMail V4.00
* Origin: Night City (1:124/4102)
*** There is a reply. See #122.
From: Chris Cason
To: Chris Day Msg #14, 03-Jan-89 08:16am
Subject: Formatting Output
Yes, there is an easier way.
By this stage, you have probably been told this ten or more times, but I have
not seen any replies that use the '*' format.
printf ("%10.*f", decimals, real_number) ;
or
sprintf ("%10.*f", decimals, real_number) ;
after all, that's what the '*' format is for.
--- ConfMail V4.00
* Origin: Software Tools - The Crocodile WOC - Sydney, OZ (3:711/403)
*** There is a reply. See #84.
From: Jeff Bauer
To: Ron Warris Msg #15, 03-Jan-89 12:25pm
Subject: Re: gettext()
>I am writing help screen routines that requires the storage of
>only the screen text where the help window is displayed. To do
>this I am using the gettext function and storing the screen text
>in an array.
>To overcome this I am simply declaring an array size
>large enough to accommodate the largest help window.
>Now it seems to me that this is a rather wasteful
You probably want to use the malloc(), calloc() and free()
functions. The nice thing about this approach is not only are
you allocating just the memory you require for each help screen,
but you are then releasing (hopefully <grin>) the memory back to
your program when you've finished displaying the help screen.
#include <stdlib.h> /* ANSI standard header file */
char *helptext; /* actual help text to be displayed */
int help_ctr; /* no. of characters (array size) of helptext */
/* First calculate help_ctr. You can compute it at runtime */
/* (preferred) or embed it in your helptext data file. */
/* Presumably you already have a way to calculate this value. */
help_ctr = ...;
/* calloc() is basically the same as malloc(), except that it */
/* initializes the reserved memory to '\0'. */
helptext = (char *) calloc(help_ctr + 1, sizeof(char));
if (helptext == NULL) {
printf("Not enough memory for calloc()\n");
exit(-1);
}
/* You may now use helptext[] as if it were an array of size */
/* help_ctr+1. Remember to append the trailing '\0' when you */
/* read in its value(s). Even though calloc() initialized this */
/* for you, it is bad practice not to do it explicitly. */
for (i = 0; i < help_ctr; i++)
helptext[i] = ...; /* or somesuch */
/* Display the helptext array. Be sure to release the allocated */
/* memory when you are finished. */
display_help(helptext);
free(helptext);
This is the general approach to use. Caveats: Be sure to check
for any typos and syntax errors in the above. Hope this helps.
--- Via OpXpress V1.03ß
* Origin: Southern Crossroads PEP and HST (1:124/4115.0)
*** There is a reply. See #132.
From: Tim Tapio
To: Barry Lynch Msg #16, 26-Dec-88 08:26am
Subject: CNews
--- QuickBBS v2.03
* Origin: Crystal Cavern Lacey, WA 206-459-7277 QuickBBS! (1:138/105)
From: Gar Nelson
To: Randall Smith Msg #17, 31-Dec-88 09:09am
Subject: Re: Windchill
RE: Wind Chill
I have a formula available at work for wind chill, and for wet/dry bulb
conversion to dew point. Unfortunatly(?) I'm at home and don't have them with
me right now. If you really want them and can't find them, drop me a line at:
Nat'l Weather Service Office Olympia
7645 Old 99 Highway SE
Olympia, Wa. 98501-5728
Attn: Gar Nelson
The programs are in TP, I've been meaning to convert them to 'C' RSN, but the
Xmas holiday got in the way...
(If I rely on remembering to post the formula when I go back to work, there is
a 99 44/100% chance I'll forget.)
--- QuickBBS v2.03
* Origin: Crystal Cavern Lacey, WA 206-459-7277 QuickBBS! (1:138/105)
*** There is a reply. See #152.
From: Eddie Rock
To: Mike Housky Msg #18, 31-Dec-88 12:50pm
Subject: Re: tokenization again
A rather thorough reader, there! Thanks for the reference to K&R, it helps to
clarify things a bit. The x -= 5 variety is much clearer, so I'm glad it is
preferred over x =- 5. Besides, for one (like me) with a tendency to
transpose characters while typing, it's quite easy to get x = -5 (and the
wrong result!).
--- QuickBBS v2.03
* Origin: Crystal Cavern Lacey, WA 206-459-7277 QuickBBS! (1:138/105)
From: Eddie Rock
To: Ejvind Frantzen Msg #19, 31-Dec-88 01:03pm
Subject: Re: boeger om c
Gee! looks like I'll have to dig up my old "Einen Ausflug auf den Deutsch
Sprache". Thought I remebered enough German to be able to read the language,
even if I can't speak it, but your message might as well have been Danish as
far as my comprehension went. Any chance of setting up a "pen pal"
relationship, so I can become conversant?
--- QuickBBS v2.03
* Origin: Crystal Cavern Lacey, WA 206-459-7277 QuickBBS! (1:138/105)
From: Eddie Rock
To: Derron Simon Msg #20, 31-Dec-88 01:11pm
Subject: Re: ZOO listing
Does your source have configuration for Amiga? If so, I would like to be able
t freq it!
--- QuickBBS v2.03
* Origin: Crystal Cavern Lacey, WA 206-459-7277 QuickBBS! (1:138/105)
*** There is a reply. See #47.
From: John Kruper
To: Bill Leary Msg #21, 01-Jan-89 05:52pm
Subject: Re: COMPUTING ADDRESS OFFSETS WITHIN
RG = Randall Greylock
RG>> typedef struct {
RG>> int A;
RG>> int B;
RG>> int C;
RG>> } _MyStruct;
> int C_offset;
> _MyStruct *tMS = (_MyStruct *)0;
> C_offset = (int)( (long)( &tMS->C ) - (long)( tMS ) );
You don't need the tMS variable, since you can just do:
C_offset = (size_t) &(((_MyStruct *)0)->C)
size_t is typedef'd in <stddef.h>, and will be an unsigned int of the size
needed to hold the result. In this case, since we know the answer will be
small, a cast to an (int) would be fine, too. Though the expression looks
complex, the compiler should be able to compute it at compile time and insert
the results in the code as a constant (which is not true of the tMS approach
unless the compiler is really clever).
> I'm using the pesimistic assumption that a pointer should be converted to
> a long before being used. In fact, I just re-ran this on the above
> machine without the (long)'s and it worked fine.
Since you are subtracting two pointers to different types (a pointer to an int
minus a pointer to a structure) you need to do some sort of cast on one or
both of them before the subtraction is legal. In practice, a cast to (char *)
might have a better shot at working on bizarre architectures than the cast to
(long), but (long) is a reasonable thing to do. (Though using (size_t) would
be a more portable approach.)
--- msged 1.87S ZTC
* Origin: A point in space (off of P.I.E.) ( 1:343/27.3)
*** There is a reply. See #36.
From: John Kruper
To: Felix Castillo Msg #22, 01-Jan-89 01:28pm
Subject: Re: Buffer conversion
> /* convert from buffer to integer */
> int btoi(char *buff)
> {
> int i=0,v1,v2=0;
> while(*buff && i<2) { /* allow max of two bytes */
> if((v1=*buff++)<0) v1+=256;
> v2=v2+(v1<<(8*i++));
> }
> return(v2);
> }
You've got a bug in this fragment. What happens if *buff is zero, but
*(buff+1) isn't? The loop will break on the first *buff (since it is zero),
and btoi() will return zero when it should have returned *(buff+1)<<8.
Modifying your approach to remove the bug:
for (i=0, v2=0; i<2; i++, buff++) {
if (*buff) {
.... [same as before, but w/o the ++ on i and buff]
}
}
Some hints for greater speed and smaller code size (which admittedly may not
be important to you). You might want to go with:
int btoi2(unsigned char *buff)
{
return *buff + *buf<<8; /* assumes little endian */
}
The test for the byte being less than zero can be avoided by telling the
compiler that the char *buff is unsigned (or by leaving the char *buff signed,
but putting a cast to (unsigned char) on each reference to *buff). This saves
on executable code and space, and removes the need for the v1 variable. Also,
the inside of the loop is then much simpler, and it makes sense to "unroll"
the loop (i.e. remove the loop and write out each iteration explicitly as I
did in btoi2() above). Also, notice that the loop approach can't avoid doing a
<< on v1 the first time through the loop, even though this won't do anything
useful (since v1 is then zero).
> /* convert from buffer to long integer */
> long btol(char *buff)
> {
> int i=0,v1,v2=0;
> while(*buff && i<4) { /* allow max of four bytes */
> if((v1=*buff++)<0) v1+=256;
> v2=v2+(v1<<(8*i++));
> }
> return(v2);
> }
Similar comments apply here. Also, you've got another problem since you are
accumulating the sum of a long in an int variable (namely v2). So, a large
long value will "wrap around" in the int v2, and btol() will return the wrong
value.
Since we have four bytes to process, it makes sense to keep your loop:
long btol2(char *buff)
{
int i;
long l;
for(i=0, l=0L; i<4; i++, buff++) {
l = l << 8;
if (*buff)
l += (unsigned char) *buff;
}
return 0L;
}
I left in your optimization of only processing non zero bytes in buff - this
will be a win if zero bytes are expected to be common.
But notice that we have several variables doing basically the same thing: i,
buff, and l are all being incremented once through the loop. So, maybe some of
this activity is redundant? Instead of all of this shifting, look at this
approach:
long btol3(char *buff)
{
long l;
char *p, *pEnd;
for (p=(char *)&l, pEnd=p+sizeof(long), l=0; p<pEnd; p++, buff++) {
if (*buff)
*p = *buff;
}
return l;
}
We don't have to worry about signed vs unsigned issues here, since we aren't
doing any arithmetic on *buff, but just copying bits.
Now we've reduced things to so that three variables (instead of two) are
active in the loop. However, writing the function this way should make it
clear that we really aren't doing anything to the bytes in buff but copying
them to the bytes in l. Which is why the simplest way to do this is to use a
cast:
#define btol4(buff) (*(long *) buff)
#define btoi3(buff) (*(int *) buff)
The macros are telling the compiler to interpret the address of buff as if a
long were stored there (because in fact, there *is* a long stored there).
So, the following would then work:
printf("%ld", btol4(buff));
or
long l;
l = btol4(buff);
--- msged 1.87S ZTC
* Origin: A point in space (off of P.I.E.) ( 1:343/27.3)
*** Part of a conversation.
From: John Kruper
To: Mike Housky Msg #23, 01-Jan-89 01:31pm
Subject: Re: union and struct
>>> union {
>>> struct tag1 {
>>> char fname[16]; /* 15 chars + '\0' */
>>> char mi;
>>> char lname[21]; /* 20 chars + '\0' */
>>> } name1; /* total of 36 chars + 2 '\0' */
>>> char name2[sizeof(struct tag1)];
>>> } name;
>>>
>>> Later, you can use sizeof(name.name2) as the constant array size,
>>> when needed. Note that this is only quasi-portable, but will
>>> translate to most machines with byte addressing.
>> Why is this only quasi-portable ?
> I don't think there is a guarantee that character scalars and/or arrays
> will not have alignment considerations on all implementations.
> However, most real machines will map the name2[] "as expected" over the
> struct without a problem.
I see what you mean. I looked in Harbison and Steele, and in the ANSI draft,
and you are right: there can be padding placed *before* a union member. So,
the address of name.name2 isn't necessarily the same as the address of
name.name1. As a result (as you say) name.name2 isn't guaranteed to overlay
name.name1.
I was a little surprised to see that ANSI didn't just require that unions be
aligned to the least common denominator of the union's members. This would
guarantee that all members of a union start at the same address. However, I
guess that unions were never intended to be used to convert from one data type
to another, but simply to allow memory to be "reused" for different purposes.
Also, there may be some architecture in which there is no least common
denominator alignment, or in which such an alignment would be very
inefficient.
--- msged 1.87S ZTC
* Origin: A point in space (off of P.I.E.) ( 1:343/27.3)
*** There is a reply. See #127.
From: Ron Dexter
To: Henry Piper Msg #24, 02-Jan-89 08:24pm
Subject: Re: Pascal to C
> Starting with Turbo Pascal 4.0 Borland started using .EXE
> programs as the ouput of their compilers. So, if you switch
> to version 5.0 of TurboP you will go back to small .EXE
> files, even smaller, in a lot of cases than the files Turbo C produces.
Why??
Why did Borland go to EXE files, are they really any better?
Tell me if I'm right; EXE files are prefered because you can
continue to add or link to them???; and COM files are good because
they "can be" small and faster???
( ^^-- Never have gotten this straight!)
Ron
---
* Origin: Burrell's Ballpark (Opus 1:138/52)
*** There is a reply. See #64.
From: Ron Dex2.115) - Home for wayward Thalidomide Frogs
owe Msg #25, 02-Jan-89 08:29pm
Subject: Re: Price of Turbo C V2.0 in the USA
Turbo C v.2.00 usually runs between U.S. $99 and $120.
If you're lucky you may find a BIG discounter for even cheaper.
Ron
---
* Origin: Burrell's Ballpark (Opus 1:138/52)
From: Ron Dexter
To: Paul Schlyter Msg #26, 02-Jan-89 08:31pm
Subject: Re: Turbo Pascal 5.0
> functions (including GotoXY) in the Crt unit available
> to the program.
>
> This is clearly described in the Turbo Pascal ver 4 & 5
> manuals.
> Don't you read the manuals????
^
What are you talking about, you should
know never to read manuals and instruction
books until everything else fails! <GRIN>
---
* Origin: Burrell's Ballpark (Opus 1:138/52)
*** There is a reply. See #39.
From: Doug Boone
To: Jon Guthrie Msg #27, 02-Jan-89 02:04am
Subject: Re: HELLO.
Jon Guthrie of 1:14/627 writes:
>1) C uses '{' and '}' instead of 'BEGIN' and 'END'
>
>
Huh. You haven't seen anything by Wynn Wagner III. First thing is:
#define BEGIN {
#define END }
Poof, C code that looks like Pascal.
--- msged 1.95S ZTC
* Origin: LAZARUS: ChicoNet WOC Host (916) 893-9019 (1:1/113)
*** Part of a conversation.
From: jim nutt
To: Wayne Hamilton Msg #28, 02-Jan-89 11:00am
Subject: The Rules as I see them
In a message of <01 Jan 89 00:35:07>, Wayne Hamilton (1:232/400) writes:
>jim, could you add a revision datestamp to the rules you post? i use a
>scheme to keep such rules resident, and if they are reposted without
>change, i could save some manual maintenance effort...
well.. i suppose. for the most part, they aren't going to change unless
something radical happens....
jim nutt
'the computer handyman'
--- msged 1.96S ZTC
* Origin: numerology: recreational computer science (1:114/15.11)
From: Dana P'simer
To: Charlie Frnka Msg #29, 01-Jan-88 10:22am
Subject: Re: Turbo C 2.0 Library
> > No, TurboC is not appending anything, it's just not
> > striping the '\n's .
> Actually, (since we're splitting hairs here :-) fgets()
> appends a '\0' to the string.
Go Ahead! Get picky why don't you! <GRIN> Actually you are right, that
is why you must supply a bufferr one larger than the number of characters you
actually want as a maximum.
Dana P'Simer
--- QuickBBS v2.03
* Origin: C'ing Clearly Into the Wind (303)939-9272 * FidoNet (1:104/63)
From: Bruce M. Miller
To: Rubens Abboud Of 167/146 Msg #30, 01-Jan-89 02:08pm
Subject: Re: TC2.0 - FEOF() BU
***** Quoting message from Rubens Abboud Of 167/146 to Larry Marshall *****
.... I guess this is the classic "accuse now, dealwith it later" attitude that
clearly explains why Fidonet was the first to coin the term "flaming".
***** End Quote *****
The term "flaming" predates Fidonet by MANY years.
--- Gnome v1.30
* Origin: Froghold -- (1:104/62.115) - Home for wayward Thalidomide Frogs
From: Bruce M. Miller
To: George Kamenz Msg #31, 01-Jan-89 12:22pm
Subject: Re: Learning C
GK> It would be completely inappropriate for someone learning a language
GK> (evenworse if it is his/her first language) on his/her own to begin
GK> by relying ona debugger. My mind, and yours, are much more versatile
GK> tools than any of thesoftware only debuggers I've seen.
But a debugger is EXTREMELY useful when learning a language. It allows you
to find out what the code is doing (as opposed to what you thought it meant).
If your code is doing something unintended due to your misunderstanding of
syntax, a debugger will often immediately point this out.
GK> Most bugs can be traced back to their cause without a debugger.
GK> That is especiallytrue for those persons who think about the bugs
GK> and possible causes beforerunning the code while sitting in front
GK> of a debugger.
The question (to me) is not whether doing it yourself results in superior
mental discipline (it may) - it's whether you get the problem solved more
rapidly with or without a debugger. I find the majority (or at least
plurality) of my bugs are due to the source code not saying what I intended.
Not so much typos as, e.g., when I copied this from that section, I only
changed the variable name in 4 of 5 places, and now it1.31
* Origin: Duck Point -- Where Cing is o be portable, buty find this by scouring the listing °?
--- Gnome v1.30
* Origin: Froghold -- (1:104/62.115) - Home for wayward Thalidomide Frogs
*** Part of a conversation.
From: Bruce M. Miller
To: George Kamenz Msg #32, 01-Jan-89 12:49pm
Subject: Re: Learning C
GK> It would be completely inappropriate for someone learning a language
GK> (evenworse if it is his/her first language) on his/her own to begin
GK> by relying ona debugger. My mind, and yours, are much more versatile
GK> tools than any of thesoftware only debuggers I've seen.
But a debugger is EXTREMELY useful when learning a language. It allows you
to find out what the code is doing (as opposed to what you thought it meant).
If your code is doing something unintended due to your misunderstanding of
syntax, a debugger will often immediately point this out. A debugger is a
useful way of finding out how an unfamiliar language treats an obscure piece
of code.
GK> Most bugs can be traced back to their cause without a debugger.
GK> That is especiallytrue for those persons who think about the bugs
GK> and possible causes beforerunning the code while sitting in front
GK> of a debugger.
The question (to me) is not whether doing it yourself results in superior
mental discipline (it may) - it's whether you get the problem solved more
rapidly with or without a debugger. I find the majority (or at least
plurality) of my bugs are due to the source code not saying what I intended.
Not so much typos as, e.g., when I copied this from that section, I only
changed the variable name in 4 of 5 places, and now it does strange things.
Granted, it would be possible to eventually find this by scouring the listing
until I noticed the error - but you tend to see what you expect to see, and it
might take me 3 or 4 passes through the code before I noticed it. A debugger
is a lot faster.
I'll also grant that there are a lot of things for which debuggers are NOT
suitable. But I've found that I use them more for FINDING problems, rather
than analyzing code. The problem is usually trivial once located.
I remember once spending 4 hours (with no debugger handy) before finding that
I had typed a "j" for an index in a loop whose index variable was "i" - the
previous loop had used both i & j, and so j was legal and had a value. I knew
where the problem had to be - but I just kept reading what was supposed to be
there instead of what was. Debuggers don't do that, which is why I like them.
--- Gnome v1.30
* Origin: Froghold -- (1:104/62.115) - Home for wayward Thalidomide Frogs
*** Part of a conversation.
From: Scott Ladd
To: Grant Wagner Msg #33, 01-Jan-89 09:19pm
Subject: Re: QuickC 2.00
Yes, your 1.0x Code will work with 2.00 without problem.
Microsoft made a number of bug-fixes between 1.00 and 1.01; the biggest of
these was providing a work around for a conflist with a buggy Western Digital
HD controller.
I have talked with Greg Lobdell, the person who oversees all of the 'Quick'
languages at Microsoft. He confirms my interpretation: you own your source and
the resulting .EXE file. All Microsoft owns is the copyright to the library
routines, for which it charges nothing. Microsoft's license is worded such
that people become confused by it; the only time you have to give Microsoft
any direct credit is when your use one of their run-time .EXEs, such as
BRUN45.EXE for QuickBASIC, or MSHERC.COM for Hercules compatibility.
--- Gnome v1.31
* Origin: Duck Point -- Where Cing is o be portable, but it (or some variation
JK> thereof) "usually" works.
JK>
JK> ANSI C includes a function/macro called offsetof() in stddef.h for just
JK> this purpose. My OffsetOf() macro above is one of the implementations
JK> that the Rationale suggests as possible for the ANSI offsetof().
Yes, but can these be used while statically initing ANOTHER structure? I.E.,
no ='s?
--- ConfMail V4.00
* Origin: Greylock (1:321/202.4)
*** There is a reply. See #240.
From: Randall Greylock
To: Paul Schlyter Msg #39, 03-Jan-89 11:10am
Subject: Re: Turbo Pascal 5.0
PS> This is clearly described in the Turbo Pascal ver 4 & 5 manuals.
PS> Don't you read the manuals????
More importantly, what is this doing in the C-Echo?
--- ConfMail V4.00
* Origin: Greylock (1:321/202.4)
*** This is a reply to #26.
From: Bill Leary
To: Paul Schlyter Msg #40, 04-Jan-89 08:42am
Subject: Re: C AND UNIX
re: kermit & 8th bit quoting.
I'll yield to your apparently superior knowledge in this area. I was passing
on an observation from someone at work when we had a similar problem with
Kermit on the VAX dropping the 8th bit. We fixed the problem with an 'stty'
statement before I had to actually test this feature.
--- TBBS v2.1
* Origin: Cul-De-Sac Bar & Grill *SeaDog 4.5 & HST* 508-429-8857 (322/360)
*** There is a reply. See #102.
From: Bill Leary
To: George Kamenz Msg #41, 04-Jan-89 08:45am
Subject: Re: C PROGRAMS
BL> main(){}
BL> which works fine on every system I've tried and does exactly what
BL> you'd expect. Nothing.
GK> Do you happen to have comparitive timings? :-)
Actually, the VAX reports a very VERY low amount of system overhead, and no
user time when I run it. I guess the overhead is from loading and discarding
the program, and probably from the call to '_exit'.
--- TBBS v2.1
* Origin: Cul-De-Sac Bar & Grill *SeaDog 4.5 & HST* 508-429-8857 (322/360)
*** There is a reply. See #103.
From: Bill Leary
To: Bob Stout Msg #42, 04-Jan-89 10:00am
Subject: Re: CTL-C/BREAK
re: system("BREAK OFF");
Well, no, this won't stop all control-C/control-BREAK's from halting your
program. It just turns off the check for break that DOS does before and/or
after many non-console related operations. If you do a console operation (like
getchar, or printf) and you haven't done something to keep the console driver
from handling control-C/control-BREAK, it will still stop your program with
the usual abort. The window of oportunity for the ^C/^BREAK taking you down is
much lower, but it's certainly still there.
--- TBBS v2.1
* Origin: Cul-De-Sac Bar & Grill *SeaDog 4.5 & HST* 508-429-8857 (322/360)
*** Part of a conversation.
From: Bill Leary
To: Drew Macinnis Msg #43, 04-Jan-89 10:06am
Subject: Re: PRODUCTIVITY
The .COM file contains no relocation data and is limited to 64K code, data,
and the rest. It *CAN* make calls to DOS to get more memory, but it can
usually only use that for data (unless you've got some way to play games with
overlays in that memory you get from DOS).
The .EXE file contains relocation information, and can use a theoretical
unlimited amount of memory for code, data, stack, heap, etc. The .COM file
was, more than anything else, kept for compatibility with CP/M when DOS was
first introduced.
Oh, almost forgot, a .COM file loads somewhat faster than a .EXE, though the
difference is often undetectable.
--- TBBS v2.1
* Origin: Cul-De-Sac Bar & Grill *SeaDog 4.5 & HST* 508-429-8857 (322/360)
*** There is a reply. See #143.
From: Bill Leary
To: Jeff Bauer Msg #44, 04-Jan-89 10:27am
Subject: Re: NON-ANSI C
JB> My approach would be to plce the prototypes in the header files
JB> and use AWK to move the variables outside the function parenthesis
JB>
JB> ie: int doit(int cnt, char *str) {
JB> ...
JB> }
JB>
JB>BECOMES int doit() {
JB> int cnt;
JB> char *str;
JB> ...
JB> }
I don't think that BECOMES will work. At least, my compilers complain that
'cnt' and 'str' aren't in the argument list. What you want it to become for
K&R compatibility is :
int doit(cnt,str)
int cnt;
char *str;
{
....
}
With, of course, whatever your preferenace might be for indentation.
--- TBBS v2.1
* Origin: Cul-De-Sac Bar & Grill *SeaDog 4.5 & HST* 508-429-8857 (322/360)
*** There is a reply. See #54.
From: Juyt Sternala
To: All Msg #45, 02-Jan-89 10:04pm
Subject: LEARNING C
To All:
My name is John Sternala, I am an engineering student, and I
would like to learn C. I have had a semester of Turbo Pascal
and would appreciate any info of books and software to help
in learning C. Information on writting to the ports would
also be welcomed.
Thank You,
John Sternala
--- TBBS v2.0
* Origin: APOLLO SYSTEMS TBBS - Chicopee, MA (413)594-2524 (321/301)
*** Part of a conversation.
From: Randall Greylock
To: John Kruper Msg #46, 04-Jan-89 11:54am
Subject: Re: COMPUTING ADDRESS OFFSETS WITHIN
JK> RG = Randall Greylock
JK> RG>> typedef struct {
JK> RG>> int A;
JK> RG>> int B;
JK> RG>> int C;
JK> RG>> } _MyStruct;
JK>
JK> > int C_offset;
JK> > _MyStruct *tMS = (_MyStruct *)0;
JK> > C_offset = (int)( (long)( &tMS->C ) - (long)( tMS ) );
JK>
JK> You don't need the tMS variable, since you can just do:
JK>
JK> C_offset = (size_t) &(((_MyStruct *)0)->C)
Earth to moonbase everyone! I DON'T WANT TO DO THIS AT RUN TIME!
Let me restate the problem.
Assume TWO structures - _MyStruct as defined above, and:
typedef struct {
char FldNm[30];
unsigned int Offset;
} _MyOffset;
What I want to do is something like this:
_MyOffset = {
"Variable C",
[computed offset to C in _MyStruct goes here]
};
I.E., I want to do it STATICALLY! At COMPILE TIME. Not run time.
--- ConfMail V4.00
* Origin: Greylock (1:321/202.4)
*** Part of a conversation.
From: Randall Greylock
To: Eddie Rock Msg #47, 04-Jan-89 11:57am
Subject: Re: ZOO listing
ER> Does your source have configuration for Amiga? If so, I would like to
ER> be able t freq it!
The sources I have (Z201Src*.Zoo) talks about Amigas.
--- ConfMail V4.00
* Origin: Greylock (1:321/202.4)
*** Part of a conversation.
From: Randall Greylock
To: Bob Stout Msg #48, 04-Jan-89 12:00pm
Subject: Mix Power C
BS> inflammatory (potentially leading into the dreaded "compiler wars"),
You don't suppose we could get these banned by the geneva convention, do you?
--- ConfMail V4.00
* Origin: Greylock (1:321/202.4)
*** There is a reply. See #145.
From: Randall Greylock
To: Roy Browning Msg #49, 04-Jan-89 12:01pm
Subject: Problem reading message
RB> the message exemplifying the problem. Can someone supply him with some
RB> software that will delete every message emanating from my Board? For I
A bit difficult in echomail. A utility called KillrDog can easily be used to
kill all messages from a given person, however. Available my system as
KillrDog.Zoo if you want to pick it up and mail it to whoever.
--- ConfMail V4.00
* Origin: Greylock (1:321/202.4)
*** There is a reply. See #202.
From: Roy Tellason
To: Dana & Bruce Msg #50, 04-Jan-89 05:39pm
Subject: getting started in c
From Mike Daly:
MD> What files do I need to download from Area 18 in the files
MD> area in order to create, compile, link a program in C?
From Dana P'Simer:
DP> BUT I think I can help you anyway. [stuff deleted]
DP> if you want a real C compiler I suggest you take a look
DP> at Zortech C, or QuickC [more stuff deleted]
DP> for creating the C programs you will need a good text editor,
DP> there are several ShareWare and PD/FreeWare editors out there
DP> such as MicroEmacs, QEDIT, and others. [and so on...]
From Bruce M. Miller
BM> for a good, cheap start you might try buying Power C from
BM> Mix Software. [etc.]
Hey guys, where did he say he was using ms-dos, eh? :-)
--- Opus-CBCS 1.10.0f
* Origin: TThe ANSI compilers can
handle the old method
*** P #176.
From: Roy Tellason
To: Rod Whitworth Msg #51, 04-Jan-89 05:39pm
Subject: Source to libs
> Let's all vote that compiler vendors do what Whitesmiths (used
> to) do, that is supply the lib source and supply the .obj files
> for all their executables so that they can be ported to any
> environment using the same instruction set. I don't know if
> it still happens but way back it made it possible to port
> their CP/M 8080 compiler to our z80 unix system.
This is the first that I've heard that Whitesmiths made a cp/m compiler.
While I'd guess that they're not pushing it these days, I'm going to have
to see if they will still sell it at all. Also, you did say "z80 unix
system" back there. I'd be interested in hearing more about that, too.
Did it perform at all well?
--- Opus-CBCS 1.10.0f
* Origin: The Other BBS (1:150/501.0)
From: Roy Tellason
To: Martin Maney Msg #52, 04-Jan-89 05:40pm
Subject: Re: Buffer conversion
> /\/\artin (the data may run, but it cannot hide)
Heh heh. I just picked up a button the other day that says "If you
torture the data enough, it will confess". <grin>
I did something like what you're saying with use of an array of char for a
buffer, etc., but I fed the address of the buffer to functions that
thought they were dealing with structs, so I didn't have to mess around
with all that casting of pointers and such.
--- Opus-CBCS 1.10.0f
* Origin: The Other BBS (1:150/501.0)
*** This is a reply to #22.
From: Roy Browning
To: Joseph Mann Msg #53, 31-Dec-88 09:57am
Subject: Let's C
Joseph:
I use the Mark Williams Let's C package. If you have questions you can
NetMail me directly. Let's C could best be used by someone working in both
the Unix and PC environments. It is a full K&R compiler, not ANSI compatible.
Personally I have learned how to use it effectively and it is my first choice
when developing a program. However for a totally inexperienced user Power C
might have been a better selection.
As to your problems, call Mark Williams at (800)MWC-1700. For I've
used it on both an 8088 and 80386 with no problems. Plus Dave Giunti recently
ran a program compiled on my machine and he uses a V20 as his processor.
Someone getting frustrated with MWC is how Bob Stout obtained his copy
of Let's C. And I haven't found any compiler I couldn't blow up in a week of
concentrated programming! So if anyone gets disgusted and wants to throw one
away we'll take `em, by jimminie.
I hope you solve your problems,
Roy Browning
--- msged 1.943L MSC
* Origin: The Fulcrum's Edge ____WO'C'ing___the___Line____/\__ (713)350-6284
Spring, Texas (1:106/506.1)
*** There is a reply. See #55.
From: Roy Browning
To: Jeff Bauer Msg #54, 03-Jan-89 08:10pm
Subject: Non-ANSI C
In a message of <02 Jan 89 11:34:53>, Jeff Bauer (1:124/4115) writes:
>i.e. int doit(int cnt, char *str) {
> ...
> }
>
Jeff:
As a K&R 'C'eer I can tell that that won't fly. The ANSI compilers can
handle the old method
*** Part of a conversation.
From: Roy Browning
To: Joseph Mann Msg #55, 04-Jan-89 01:50am
Subject: Let's C
Joseph:
I use the Mark Williams Let's C package. If you have questions you can
NetMail me directly. Let's C could best be used by someone working in both
the Unix and PC environments. It is a full K&R compiler, not ANSI compatible.
Personally I have learned how to use it effectively and it is my first choice
when developing a program. However for a totally inexperienced user Power C
might have been a better selection.
As to your problems, call Mark Williams at (800)MWC-1700. For I've
used it on both an 8088 and 80386 with no problems. Plus Dave Giunti recently
ran a program compiled on my machine and he uses a V20 as his processor.
Someone getting frustrated with MWC is how Bob Stout obtained his copy
of Let's C. And I haven't found any compiler I couldn't blow up in a week of
concentrated programming! So if anyone gets disgusted and wants to throw one
away we'll take `em, by jimminie.
I hope you solve your problems,
Roy Browning
--- msged 1.943L MSC
* Origin: The Fulcrum's Edge ____WO'C'ing___the___Line____/\__ (713)350-6284
Spring, Texas (1:106/506.1)
*** This is a reply to #53.
From: Roy Browning
To: Jeff Bauer Msg #56, 04-Jan-89 01:49am
Subject: Non-ANSI C
In a message of <02 Jan 89 11:34:53>, Jeff Bauer (1:124/4115) writes:
>i.e. int doit(int cnt, char *str) {
> ...
> }
>
Jeff:
As a K&R 'C'eer I can tell that that won't fly. The ANSI compilers can
handle the old method of function declaration but the K&R compilers can't
handle the prototypes!!! Every functions will have to be hand modified or or
both versions incorporated with #defines. Example:
#ifdef ANSI
int doit(int cnt, char *str){}
#else
/* K&R */
int doit(cnt, *str)
int cnt;
char *str;
{}
#endif
Thus far ANSI 'C' has only been a problem to me. In a large program it
takes hours just to modify the functions! If anyone does come up with an AWK
script please send me a copy and don't forget about changing the declarations
in the header files.
Still no C++ code,
Roy Browning
--- msged 1.96S ZTC
* Origin: The Fulcrum's Edge ____WO'C'ing___the___Line____/\__ (713)350-6284
Spring, Texas (1:106/506.1)
*** Part of a conversation.
From: Lee Fields
To: Ian Yokota Msg #57, 03-Jan-89 02:38pm
Subject: Re: Dr Dobbs, C Lang, And Comm Prog
>
>
> IY>Is there anyone out there reading Dr. Dobbs Journal
> of Software
> IY>Tools
> IY>or interested in C Language or even Communication.
> IY>
> IY>In Dr. Dobbs Journal they started an article where they
> are writting
> IY>a
> IY>Communication program in C. This program spans approx.
> 12 months.
> IY>I would like to get a few people together to type up
> the program.
> IY>Each person would type up 1 of the issues.
There is a Dr. Dobb's forum on Compuserve that has the source code for
articles available for downloading. Try finding someone with an account to
get them for you.
---
* Origin: PCBBS1 - Ponca City, OK - 24 Hr. Mail, File Req. (Opus 1:19/16)
*** There is a reply. See #107.
From: Bob Stout
To: Jeff Bauer Msg #58, 04-Jan-89 07:33am
Subject: Re: Walter and Micro C
Jeff...
As I mentioned to Chris Shutters, I think Walter's advice is generally sound
(even a slow multi-pass compiler is likely to be sped up), but in my
experience the payoff is minimal compared to some other optimization
enhancement tricks (e.g. less modularity). My current coding style has been
significantly influenced by several years of using Walter's optimizing
compilers and is a follows:
1. Generally code top down, i.e. main() at the top.
2. Put the tasks with the most subfunctions right below main().
3. If a task has several subfunctions, declare them along with the task in a
header block, then place them ahead of the task in which they're called.
4. Unless using the C++ modifier "inline", avoid small (2-4 lines of actual
code) functions which are only called once or twice.
This is obviously referring to a fairly small program, yet the principles
carry over when dealing with multiple modules. I always try to keep my source
files large enough to give the optimizer a chance, and each one follows the
same "overall top down, detail bottom up" style. Overall this has proven to be
an effective compromise between the conflicting requirements of
maintainability and optimization enhancement.
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** There is a reply. See #216.
From: Bob Stout
To: Jeff Bauer Msg #59, 04-Jan-89 07:45am
Subject: nawk
In a message of <02 Jan 89 11:55:32>, Jeff Bauer (1:124/4115) writes:
>An enhanced version of AWK has been released in AT&T's SysV Rel 3.1
>UNIX. This program is called nawk...
Jeff...
OK, now the real question is when will Rob Duff come up with a PC NAWK?
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
From: Bob Stout
To: Jeff Bauer Msg #60, 04-Jan-89 07:47am
Subject: Non-ANSI C
In a message of <02 Jan 89 11:34:53>, Jeff Bauer (1:124/4115) writes:
>I need to maintain compatible source between some ANSI and non-ANSI
>C environments...
>
>My approach would be to place the prototypes in the header files
>and use AWK to move the variables outside the function parentheses
>
>Does anyone have a better idea?
Jeff...
No, but once you have the AWK script written, I know Roy Browning and lots
of other MWC users would be eternally grateful if you were to post it! :-)
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** Part of a conversation.
From: Bob Stout
To: George Kamenz Msg #61, 04-Jan-89 07:50am
Subject: Re: char far *
In a message of <01 Jan 89 15:52:01>, George Kamenz (1:135/1.5) writes:
>Well... the way I did it was kind of brute force. Just pull the object out
>of the library, modify its symbol names, rename the object, and use it. It
>is a great deal of work, and now that I have the source to a library I'll
>probably do it differently next time.
George...
Yeah, great isn't it? And some people still wonder why bother with library
source... :-)
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
From: Kirby Angell
To: Stephen Thompson Msg #62, 03-Jan-89 04:57pm
Subject: Turbo C
In a message of <29 Dec 88 20:16:34>, Stephen Thompson (3:711/417) writes:
>Is there anyway that I can make a room needed for Turbo C (IBM) smaller...
>I keep running out of memory !!
>
Turbo C needs at least 400k and really 500+ to compile much of anything with
the integrated environment. Don't know what the command line version
requires but its more than what DoubleDos will give it.
Kirb
--- ConfMail V3.31
* Origin: Terminus -- The Programmers Interchange (1:147/42)
*** There is a reply. See #93.
From: Kirby Angell
To: Chris Crowe Msg #63, 03-Jan-89 05:12pm
Subject: Re: reading the 'command line'
In a message of <30 Dec 88 08:01:10>, Chris Crowe (3:770/400) writes:
>
>The argc is the count of the arguments the first argument is the command
>line you typed in for the name of the program.
>
The first argument (in argv[]) is the name of the program only in DOS versions
3.3 and above. In previous versions (depending on the compiler but generally)
argv[0] == NULL.
Kirb
--- ConfMail V3.31
* Origin: Terminus -- The Programmers Interchange (1:147/42)
*** There is a reply. See #111.
From: Henry Piper
To: Ron Dexter Msg #64, 04-Jan-89 06:33pm
Subject: Re: Pascal to C
You do have it right! The advantage of .COM programs are that they are faster
to load than .EXE, but are limited to 64k.(Supposedly). .EXE programs can be
much larger, but are somewhat slower to load.
--- Opus-CBCS 1.10.v
* Origin: Crystal Palace The Ghost in the Machine (1:382/1.0)
*** Part of a conversation.
From: Henry Piper
To: Scott Ladd Msg #65, 04-Jan-88 07:33pm
Subject: Re: QuickC 2.00
In you MicroCornucopia artical you said Quick C should be out by the time I
read that artical. Well... Is this going to be another DBase4.
---
* Origin: Austin Code Works -- The Source of C (Opus 1:382/12)
*** Part of a conversation.
From: Ronald Perrella
To: Patrick Wu Msg #66, 02-Jan-89 12:33pm
Subject: VAXen
Actually, you can stop calling VAXen (the's time for C II - When the Gangs Take Over the From: Anything more powerful than that COULD be considered to
be a mainframe... VAX 8800 is a BIG machine.
--- OPUS 1.03b ,Binkley and Confmail too!
--- ConfMail V4.00
* Origin: Crystal Vision 813-355-1002 Sarasota Fla Opus xpress all the
way!!!! (1:137/17)
***tch() - For somme funny reason which I don't entgjmp() to r1;40;33m Walter Purdy
To: Sysop Msg #67, 03-Jan-88 07:48pm
Subject: FD FILE
Your welcome to the files. Since I did not read your rules...
Do you have any rules against xxx files be they games or pic files. If so
I'll do some screening on my end and try not to up load any files of this
type.
P.S. I'll call back later tonight to see if you have ready the nodlist>
later
Walter
--- QuickBBS v2.03
* Origin: The Total Concept (817)573-4139 130/18.0 (1:130/18)
From: Mark Lipman
In The Heart Of The Garden City : (Opus 3:770/40ALL ME DIRECT Msg #68, 02-Jan-89 10:25am
Subject: Re: BLINKING CURSOR
Just set the starting and ending rows to be equal...
That should do it, irrespective of the screen position
--- TBBS v2.0
* Origin: Paragon Australia - Doorway to the Secret Garden (712/502)
*** There is a reply. See #92.
From: Mark Lipman
To: Steve St.laurent Msg #69, 02-Jan-89 10:32am
0;36m
FAG
FAG
FAG
FAG
FAGU L0>IJK %RFH&T$Y #"QASCWZDE"! hercules graphics. There should be a text file with new
features and errata which explains it (its with the full version -- I'm not
sure if its with quick C). It also needs the .COM file MSHERC.COM. If you
can't find it, mail me and I'll copy the relevant bits for you...
--- TBBS v2.0
* Origin: Paragon Australia - Doorway to the Secret Garden (712/502)
From: Paul Edwards
To: All Msg #70, 02-Jan-88 12:03pm
Subject: sin() in calculator
Hello all. I was wondering if someone could help me with this. A bloke
I know has written a calculator in C. Now he wants to add support for
sin, cos, tan, log and any other function that anyone might write at a
later date, such as cfact (for factorials). Now the functions may take
any number of parameters, and return int, float, double etc. When
someone types in sin(3) it is fairly obvious what they want. But how do
you convert this line into a function call to the same name? At the
moment, we have support for functions taking 1 or 2 double arguments
returning double. We do it a bit like this:
double (*fun[])() = {sin, cos, tan} ;
double (*nam[])() = {"sin", "cos", "tan"} ;
ans = fun[1](a,b) ; /* where b is uninitialized for cos */
1) Is it ok to call a function with 2 parameters, when it only expects
to receive 1?
2) Is it possible to build a parameter list?
What I would really like is to maybe have a structure that holds the
function name and string literal. I could have a macro that generates
the word sin (or whatever) and the same word enclosed in quotes. But
the main thing is to be able to just declare the function double
sin(double) ; (Or just #include <math.h>) and then just read in the
user's input, build the parameter list and get the return value
according to what the prototype says. I know I am asking for a lot, but
I reckon if it's obvious to me, I should be able to explain the
obviousness to the computer. If I was using a decent language anyway.
Maybe it's time for C II - When the Gangs Take Over the From: Chris Crowe
To: Stig Jacobsen (SysOp) Msg #71, 04-Jan-89 08:05am
Subject: Re: CTL-C/BREAK
> Furthermore, if you use Turbo-C, you must write new functions
> for kbhit(),
> and getch() - For somme funny reason which I don't entgjmp() to return to any point in the program.
Returns: ctrlbrk() returns nothing. 0 is returned by the handler
function to abort the current program. Any other value
causes the program to resume execution.
int handler(void)
{
printf("Ctrl-Brk hit, aborting....\n");
return(0);
}
void main()
{
ctrlbrk(handler);
... Rest of program ...
}
Chris.
---
* Origin: Plains BBS II : In The Heart Of The Garden City : (Opus 3:770/40ALL ME DIRECT ON 1-800-4-SEXUAL
PLEASE HAVE MASTERCARD 0R VISA READY.
I WILL TALK TO YOU DIRECTLY.
THANKS,
KEVIN CARTER
SEXUAL ADVISOR
GREG TAYLOR 876U\_[
--- QuickBBS v2.03
* Origin: No Place Like Home 301-454-0360 (1:109/711)
*** There is a reply. See #79.
From: Greg Taylor
To: Jf Messier<sysop> Msg #77, 04-Jan-88 08:41am
Subject: Re: Ultrix
FAG
FAG
FAG
FAG
FAGU L0>IJK %RFH&T$Y #"QASCWZDE"! Q
[\^@*]?[@*
??*]
?> <M>MN B VC CXZXZA !"! "! Q#"QA$EWZ%$#D 1
9^[0P,8@I1\_-/. XZ,.MOI98P X42QWZ/.0P*=@+[]^
Q"%!$WZR>0)<L+*?PO@X12Q []\ ]\[ ][ [] \
[]\\[] ZX?)<$*>O+ M7598US,INXY:1;[@0]
_-/.2Q1A3\21WQ ;:\^[@P 3
123
/ \1
2/. L;P
--- QuickBBS v2.03
* Origin: No Place Like Home 301-454-0360 (1:109/711)
*** There is a reply. See #81.
From: JF Messier
To: Paul Burke Msg #78, 02-Jan-89 10:23am
Subject: Re: TSR for Quick C
> > Please Someone tell me how to write a TSR program. I like
> > the C language
> > but i can't get the hang of writing the keep_dos. So
> > if anyone can help
>
>Paul,
>
>Writing a tsr is a little more complicated than just using keep_dos
>(I lied its a LOT MORE COMPLICATED). Get a Copy of Computer Language
>Magazine for February 1988 (for Turbo C) or March 1988 (for MicroSoft C)
>for a detailed analysis of how to write a TSR.
>
>Or, you could log onto PainFrame and search the C programming files for a
>couple of file each of which allow you to write TSR without having to deal
>with all the "gritty" details. I don't remember the names of the files,
>but there are clearly marked for TSR.
>
>roland
>
>---
There's a package named TESS which covers most interrupts you can want
to use in your programs and U can the files from many BBS'es. The files are:
TESS-C.ARC for 'C' programs
TESS-A.ARC for ASM programs
TESS-P.ARC for Turbo Pascal 4 and 5 programs
TESS-DOC.ARC for the complete documentation
I'm registered for that package. U can get the sources. Registering,
as for the sources costs $ 25.00. And then, it will cost U only $10.00 for a
complete upgrade. On CompuServe, there's a conference on that. GO CLMFOR.
All the name files can be obtained from there or can be freq'ed from my system
@ 1:163/210.0 2 get all the package, juste FReq TESS-ALL
^^^^^^^^
Happy New Year............
--- msged 1.95S ZTC
* Origin: SuperByte BBS (1:163/210)
From: Jf Messier<sysop>
To: Donley P'simer Msg #79, 22-Mar-95 09:17am
Subject: Re: TSR's & Command Line
Great !!! Is there any TSR skeleton which can be used as the
general base for TSR programming using different INT ? I know that
there's one for Turbo Pascal 3.0 : Stayres. I played with it for
one year but since I'm now a 'C' fan, I cannot do anything in TSR.
I have Quick 'C' AND CL 5.0 I will eventually order 5.1
Thanks a lot !!!
(MS) 'C' ya later....
---
* Origin: SuperByte BBS ╠═══ (819) 770-5163 ═══╣ (Opus 1:163/19)
*** This is a reply to #76.
From: Jf Messier<sysop>
To: Jeffrey Nonken Msg #80, 22-Mar-95 09:21am
Subject: Re: Please recommend a good C Tutorial
I downloaded a'C' tutorial 6 months ago. I'll check and give you
the FREQ name. It was interesting. You can use it to create your
own tutorial od sisplay system.
---
* Origin: SuperByte BBS ╠═══ (819) 770-5163 ═══╣ (Opus 1:163/19)
*** There is a reply. See #105.
From: Jf Messier<sysop>
To: Thomas Frost Msg #81, 22-Mar-95 09:24am
Subject: Ultrix
Enter the command : ps -a
This will give you all the processes on the system. For having
a list of YOUR processes, just enter : ps.
In the list, you will have for each process a number. If you
want to kill a proccess, just enter the command :
kill <#>
where <#> is the number you got from ps[-a]
---
* Origin: SuperByte BBS ╠═══ (819) 770-5163 ═══╣ (Opus 1:163/19)
*** This is a reply to #77.
From: Larry Marshall
To: Patrick Wu Msg #82, 01-Jan-89 11:01am
Subject: Re: LEARNING C
.>It is funny to see programmers play with words, since computer is so
.>straight forward. Anyway, it is purely personal taste whether one
.>chooses to use debugger or not. When I was taking courses at
.>University of Houston. The Operating Systems there takes an average
.>of twice per person.
.>
. Boy, if you talk to your "straight forward" computer the way you
talk here I wonder what results you get. I thought programmers were
known for their concern for syntax and proper language use, no matter
what the language. I just applied for a job at the University of
Houston; does everybody write like that? I wouldn't have mentioned it
except you seem to be taking George to task for proper use of the
English language. --- Larry
--- TBBS v2.0
* Origin: -*>> [SQUARE-HEADs] HST Multi-Line BBS <<*- QuebecCity (240/1)
*** Part of a conversation.
From: Ming Mar
To: Randall Greylock Msg #83, 02-Jan-89 04:41pm
Subject: Benchmarks! please D
On Christmas Day you posted a message to Heikki Suonsivu in which
you say:
> Hey, you don't suppose you can cut some of this crap out, could
> you?
>
> If I wanted to be in UseNet, I'd be in usenet.
Hmmm. Santa must've put a lump of coal in somebody's stocking.
--- TPBoard 5.0 beta 2.0
* Origin: ZAP 1rst TpBoard in Montreal,Quebec (514) 324-9031 (HST)
(1:167/136)
*** Part of a conversation.
From: Bill Graham
To: Jon Guthrie Msg #84, 02-Jan-89 02:15pm
Subject: Re: FORMATTING OUTPUT
JW> Doesn't a double "%" mean write an actual "%" character to
JW> the screen? I'd think you'd have the format string in a variable,
JW> and put the number in the string before output, the just pass the
JW> variable name instead of the string.
>No, what we're doing makes a different format string depending on the
>amount of precision you want. For example, if digits=5, then the line
>sprintf(format,"%%10.%f",digits);
>means format = "%10.5f"
Assuming the variable 'digits' is a float equal to 5, then:
sprintf(format,"%%10.%f",digits);
means format = "%10.5"
(if 'digits' is not a float, compiler warning)
what you really want is ('digits' is an int equal to 5):
sprintf(format,"%%10.%df",digits);
means format = "%10.5f"
Have to watch the %%'s.
--- TBBS v2.0
* Origin: TechTalk BBS ,Titusville,FL,407-269-5188,4-HST's (374/1)
*** This is a reply to #14.
From: Braden Claxton
To: Jeff Bauer Msg #85, 04-Jan-89 07:58pm
Subject: Re: Non-ANSI C
What does the acronym AWK mean? I have never seen that one before.
Braden
---
* Origin: The Last Stop BBS Houston, Texas ->HST (713)664-0222 (Opus
1:106/112)
*** Part of a conversation.
From: Braden Claxton
To: Albert Dayes Msg #86, 04-Jan-89 08:03pm
Subject: Re: BITSET?
The term in C is bitfield.
struct bits
{ unsigned first : 1;
unsigned second : 1;
unsigned another : 1;
} Braden[10];
---
* Origin: The Last Stop BBS Houston, Texas ->HST (713)664-0222 (Opus
1:106/112)
*** There is a reply. See #171.
From: Steve Isaacs
To: R.J. Devan Msg #87, 04-Jan-89 09:45pm
Subject: C for the IIGS
I don't have access to any reference material right now but you might look
into ORCA. I have used the ORCA Pascal and assembler packages with some
success although a little unwieldy at times but they do provide access to the
operating system and take advantage of the 65816 processor features. I haven't
been exposed to the C package for the ORCA environment but if its anything
like the Pascal its worth investigating. There are other packages available
but I have not had any experience with them.
Good luck... (spi)
--- Opus-CBCS 1.10.v
* Origin: TouchStone HST: Elk Washington: Cold n Snow (1:346/1.0)
*** There is a reply. See #166.
From: Steve Isaacs
To: Jose Bloise Msg #88, 04-Jan-89 09:52pm
Subject: WILDCAT! SysOp WANTED
I am not a sysop but do know of a fairly well run WildCat BBS in Spokane, WA
that you might try. Its called the Comfort Zone (509)467-6859. The sysop is
also running a closed BBS for the company that he works for to support
customers and outside programmers.
Later... (spi)
--- Opus-CBCS 1.10.v
* Origin: TouchStone HST: Elk Washington: Cold n Snow (1:346/1.0)
From: Joel Ward
To: Ron Dexter Msg #89, 03-Jan-88 12:16pm
Subject: Re: Turbo Pascal to Turbo C
Actually, it should be quite easy since you're obvoiusly falmiliar
with the Turbo enviornment. You'll be able to concentrate on learning the
language rather than the program. Go for it.
scuffling for a hat to eat.
.
Meanwhiwoes
[Him speamewhere in NJ -(201)539-5473- Probably too far to WOC!
(1:107/851)
From: Joel Ward
To: Kiyoshi Akima Msg #90, 03-Jan-88 12:19pm
Subject: Re: HELP!!
me> 400K just to compile a "hello world" proo be another tmations with it
if you have the patience...
- Joel
--- PeaceMail 2.03
* Origin: Somewhere in NJ -(201)539-5473- Probably too far to WOC!
(1:107/851)
From: Joel Ward
To: Bill Leary Msg #91, 04-Jan-88 02:39am
Subject: Re: COMPUTING ADDRESS OFFSETS WITHIN
How about a simple
int *i;
mpletely, who owns the rights
> to the
C program
could be consigin: Somewhere in NJ -(201)539-5473- Probably too far to WOC!
(1:107/851)
*** Part of a conversation.
From: Joel Ward
To: Chris Crowe Msg #92, 04-Jan-88 02:43am
Subject: Re: Blinking Cursor
Use the cursor shape service of BIOS. Just specify the beginning
line to be greate than than the ending line. That'll make it invisible.
- Joel
--- PeaceMail 2.03
* Origin: Somewhere in NJ -(201)539-5473- Probably too far to WOC!
(1:107/851)
*** Part of a conversation.
From: Joel Ward
To: Stephen Thompson Msg #93, 04-Jan-88 02:54am
Subject: Re: Turbo C
Try using TCC rather than TC.
-Joel
--- PeaceMail 2.03
* Origin: Somewhere in NJ -(201)539-5473- Probably too far to WOC!
(1:107/851)
*** Part of a conversation.
From: Mike Housky
To: Patrick Wu Msg #94, 03-Jan-89 08:56pm
Subject: Re: Ctl-C/Break
> ... Anyway, how would you turn the control break off?
.
Well ... normally I wouldn't. I might intercept it with signal(SIGINT,xxx) if
the compiler supported it (as does MSC, TC2.0, Power C, etc.) This does not
prevent a "^C" from being echoed to the console by DOS, but Ctrl-Break is not
likely an accidental keystroke and a well-designed program will generally
honor a request to terminate gracefully.
.
P.S. I heard some time ago about some presumably legal method for avoiding the
^C echo, using something called "40;33m Re: C AND UNIX
RK> Yes, sh everyone here woulaven't had call to find out more about this (like I
said, it's not often that you need to worry about that little ^C.) Maybe
someone else will pipe up about it.
--- Opus 1.03b <> NoOrigin 3.1
--- ConfMail V3.31
* Origin: Hog Heaven - 0.6 of a BBS in El Tor[1;40;33m Zero Eagle
Toon the
KA> co6m
e
but40;36mFrom: Mike Housky
To: Bob Stout Msg #95, 03-Jan-89 09:42pm
Subject: Re: Ctl-C/Break
[Patrick Wu:]
PW> Anyway, how would you turn the control break off?
.
> Well, under ZTC, you use:
> void dos_set_cntl_break(int on_off);
>
> Bob (-: the sound you hear is a smug snicker :-) Stout
.
Smug? If that ZTC function doesn't refer to the extended break checking that
is already controlled by the BREAK command and some INT 21h subfunction that I
have no interest in looking up, then the next sound you hear will be me
scuffling for a hat to eat.
.
Meanwhiwoes
[Him speaking to whomever:]
1.96S ZTC
* Origin: The Mystic Court of 'C': o memory
him> instead of just disk.
.
[Me speaking to him:]
me> Nahhh. The editor/compiler environment takes up over 400K ...
me> ... the same goes for QC interactive mode: both require over
me> 400K just to compile a "hello world" proo be another there with it that has the src.
--- ConfMail V4.00
* Origin: Treasure Isle Private Mail System (1:140/51)
From: Grant Wagner
To: Paul Roub Msg #99, 03-Jan-89 05:23am
Subject: Re: QuickC 2.00
> -> 2) When I compile something using Microsoft QuickC
> 1.00, who owns
> ->the .EXE file (or more completely, who owns the rights
> to the
C program
could be considered a "derivative work based on the SOFTWARE
(or MS RunTime Library in this case)".
The only reason I wonder about this is because I may one day want
to decide to sell my creation to someone, and I want to know that I am not
breaking any copyright laws by doing so (I also want to know that I won't owe
any money to MS for compiling the program using their program).
...Grant
---
* Origin: Negative Zone * 306-565-8538 (Opus 1:140/34)
*** Part of a conversation.
From: Andy Brager
To: David Nugent Msg #100, 02-Jan-88 06:04pm
Subject: Re: Smaller Programs
> There is a Unix utility (can't recall the exact name) which does EXACTLY
> what you want. You write and debug your code using a generic call to an
> error function, looking something like:
> "error ("Press ESC to continue");"
It's either mkstr or xstr.
--- FD 2.0
* Origin: What's the Point? (1:102/450.520)
From: Tony Gentile
To: jim nutt Msg #101, 04-Jan-88 09:03pm
Subject: Re: TC 2.0 woes
A side note to all this. Wouldn't it be REALLY nice if the bloody compiler
would insert a semicolon when you forget, instead of having to recompile the
whole thing? <grin>. Just something to think about!
--- QuickBBS v2.03
* Origin: CC III 202/605 (619)566-1745 San Diego CA (1:202/605)
*** Part of a conversation.
From: Jon Guthrie
To: Reiner Kunz Msg #102, 04-Jan-89 06:24am
Subject: Re: C AND UNIX
RK> Yes, sh everyone here would not take me so
seriously. It cramps my style. He he he.
Break on through,
Rubens.
--- ConfMail V3.31
* Origin: PIER 146 "Floating On A Sea Of Canadian Beer" Montreal (1:167/146)
*** Part of a conversation.
From: Zero Eagle
Toon the
KA> compiler but generally) argv[0] == NULL.
I think that you mean MS_DOS 3.0 and above. I know that it works in DOS 3.1,
and above.
- mike
--- msged 1.96S ZTC
* Origin: The Mystic Court of 'C' (1:261/5015)
*** Part of a conversation.
From: Mike Vore
To: Betsy Schwartz Msg #112, 06-Jan-89 01:02am
Subject: Re: C PROGRAMS
BS> The traditional first C program is:
BS> #include <stdio>
BS> main()
BS> {
BS> printf("Hello, World!\n");
BS> }
In the DOS world make the #include read
#include <stdio.h> We need extensions on our files!
--- msged 1.96S ZTC
* Origin: The Mystic Court of 'C': Jim Kanter
To: Russel Fouts Msg #113, 03-Jan-89 11:28am
Subject: AWK
Russell, there are two places to check.
First, the C User's Group has a public domain version of AWK available on
their disk # 236 (Highly Portable Utilities). You can send for it if you are a
member (US$20 for domestic US, US$ 30 for overseass.) Their address is:
C Users Group
Box 97
McPherson, KS 67460 USA
Membership includes a subscription to their bi-monthly magazine which has some
very interesting articles and C CODE!
You can also contact Polytron Corporation in Oregon. They publish an AWK
interpreter with or without the book by the language's authors.
Polytron Corporation
1700 NW 167th Place
Beaverton, OR 97006 USA
They also have other software packages that are of interest to many
programmers.
Hope this helps. Jim.
---
* Origin: T.S.C. Norwalk,CT 203-854-9716; On the Sound! (Opus 1:141/245)
From: Drew Moen
To: Charlie Milhans Msg #114, 04-Jan-89 09:14am
Subject: Re: Code Generators
-> The 24 hour number for the Software Bottling Company is 1-800-872-8787.
-> Ask for Operator 311. This is only and ordering line. I purchased my
-> software direct. The Software Bottling Company, 6600 Long Island Expy.,
-> Maspeth, NY 11378 718-458-3700. They'll send you literature if you
-> want. I was able to modify their templates so that it will incorporate
-> some of my C code instead of theirs. It is really an amazing product
-> for the money. I especially enjoy the ability to design screens and
-> fields with ease. It will put all of the error checking in your code.
-> You can also specify input fields that will only take certain values
-> that you input as a list to softcode. It generates pretty good code for
-> both Turbo C and Microsoft C. Feel free to ask if you need any more
-> help.
Is the product your talking about "SOFTCODE"? If not what is it and how
much?
Drew Moen 362/101.6
--- msged 1.90S ZTC
* Origin: M C A...... 'C'-ing our way in the DARK (fidonet 1:362/101.6)
*** Part of a conversation.;40;36m
From: Jim Gates
To: Chris Crowe Msg #115, 05-Jan-89 08:50am
Subject: Re: Blinking Cursor
Did you try putting 2000H in CX? This works for me. If you still have
problems, let me know and I will put the code I use in my next message to you.
---
* Origin: MY BBS (Opus 1:124/6120)
*** This is a reply to #92.
From: Chris Edwards
To: All Msg #116, 05-Jan-89 12:24pm
Subject: .COM
DBASE ALLOWS THE LOADING OF USER DEFINED ROUTINES (COMMANDS) . THEY SHOW HOW
TO WRITE ONE USING ASSEMBLY. THE REQUIREMENTS ARE AS FOLLOWS:
- IT MUST ORIGINATE THE FIRST EXECUTABLE INSTRUCTION AT AN OFFSET OF
ZERO.
- THE PROGRAM MUSTNOT ALLOCATE OR USE MEMORY OVER AND ABOVE ITS ACTUAL
SIZE.
- RETURN CONTROL TO DBASE USING A FAR RETURN.
- THE SHOW AN EXAMPLE USING MASM, LINK, AND THEN EXE2BIN.
HOW CAN I PRODUCE EXE2BIN'ABLE' .EXE USING MICROSOFT C.????
PLEASE HELP.!!!
---
* Origin: Alpha Centuari BBS -- WOC'n to the Stars! (Opus 1:124/1223)
From: Jeff Bauer
To: Paul Allen Msg #117, 05-Jan-89 12:02pm
Subject: Re: zortech, c++
>How does c++ remain compatible with c? Does it compile c++ source to
>c source? As in: How would I get a Zortech c++ program to work
>with a C compiler on some foreign machine (say, a vax) if there is
>no c++ compiler for it?
>
>Also, what exactly is object oriented programming? Could this be in
>reference to, say, a pointer to something that could be either a data
>structure or a function and the object will describe itself? What
>would be an example of non-object oriented programming?
1) C++ is a superset of the C language.
2) Some C++ compilers (Zortech) are native code compilers. Others
preprocess your code into C source, but the usually target a
particular environment.
3) You wouldn't.
4) "The basic support a programmer needs to write object-oriented
programs consists of a class mechanism with inheritance and a
mechanism that allows calls of member functions to depend on the
actual type of an object (in cases where the actual type is
unknown at compile time) ... facilities for supporting data
abstraction techniques are important because the arguments for
data abstraction and for its refinements to support elegant use
of types are equally valid where support for object-oriented
programming is available ... Object-oriented programming simply
allows user-defined types to be far more flexible and general
than the ones designed using only data abstraction techniques."
(Bjarne Stroustrap: "What is 'Object-Oriented Programming?'")
5) Sort of, but not quite.
6) Whatever method you're using now.
--- Via OpXpress V1.03ß
* Origin: Southern Crossroads PEP and HST (1:124/4115.0)
*** Part of a conversation.
From: Steve Jordan
To: Bob Stout Msg #118, 05-Jan-89 05:07pm
Subject: Re: Ctl-C/Break
> intdos(®s, ®s);
Excuse me. Why would a program compile and work in a Large model, comile and
fail in a medium model? No machine language, but "int86dos" library calls.
Actually, I am trying to interface with Btrieve. I can give the symptoms, but
realistically, the return value from the int86 call is bad.
(I am new to C.)
--- ConfMail V3.31
* Origin: Surf BBS - Lompoc, CA (1:102/2871)
*** Part of a conversation.
From: Kevin Wang
To: Paul Schlyter Msg #119, 05-Jan-89 08:40am
Subject: re: Turbo vs. 2.0
SUBJECT: Don't forget Quick C....
>> Does anyone have good knowledge of Turbo C vs. 2.0? Is it worth the
>> update or should I save some $$ ? I use mostly the small and med.
>> models. Thanks in advance for some input.
>
>The integrated debugger in TC 2.0 alone makes it worth the upgrade,
>according to my opinion.
>
>Then there's some other enhancements as well...
Let me ask this further question: Do you remember absolutely all the
commands, and never have to look them up in the reference book? Well, Quick C
has a neat function in it...put your cursor over a particular function, press
Shift-F1, and you will get a syntax/usage of that particular function. One
neat thing that I'd like to see implemented in Quick C, tho are: (2 of them)
1: Write marked block to disk
2: Change variables on-the-fly (while stepping line-by-line through the code)
I am not sure if these have been put into newer versions of Quick C, as I am
still with V1.01 (basically, 1.0 with a few bug fixes: nothing new)
Kevin Wang
--- ConfMail V3.31
* Origin: Carl's Corner; for FidoCon '89 | Carl Linden (1:143/1)
*** Part of a conversation.
From: Ian Yokota
To: Renald Loignon Msg #120, 01-Jan-89 10:43am
Subject: Re: DR DOBBS, C LANG, AND COMM PROG
Thanks a lot I would realy apreciate it.
--- TBBS v2.0
* Origin: C-PC C'ing it at all hours.. 514 937-1857 (167/106)
*** This is a reply to #107.
From: Larry Marshall
To: Joseph Mann Msg #121, 02-Jan-89 12:27pm
Subject: Re: QUICKC 2.00
.>I just bought Let's C. I think it sucks. I am just a begining in C.
.>I have been reading about all of these horrors about TC2. Is QuickC
.>any better or should I just stick with Lets C. Has anybody ever heard
.>of Lets C. If so give me a little input to what you all think. I
.>don't really know. Personally I think it sucks. But I have never
.>worked with the other compilers on the market so don't really know.
.>
. I don't want to defend TC2 but since you mention that you're just
beginning with C I assume you're new to Cecho as well. ALL compilers
have bugs in them. That may be the only statement one can make in
this echo without getting disagreement. You'll find that each time a
major compiler manufacturer churns out a new release there will be a
whole bunch of "bug reports" and discussion. Some of these can be
traced to operators used to other compilers or previous versions of
the compiler. Some are undoubtedly real bugs in the compiler. At
this time both Zortech C and Turbo C are in that "phase". When Quick
C was released there were about a zillion "bug reports" generated
because you have to add functions to the primary library if you're
going to use them and that people found out that you could only use
the medium module from the environment. This doesn't make the
compiler better or worse, just different.
. Here's a "for instance" relative to TC2. All the bug reports here
regarding fread() must have some merit. On the other hand, I'm using
fread() in association with feof() in exactly the manner described by
those reporting bugs. If I read the file in chuncks smaller than 512
bytes everything works fine. If I define a buffer separately I can
read that same file in any size I choose. The fread() quits at the
end of file everytime. The programs have the same action with TC as
they do with ZTC. As a beginner myself I certainly can't argue with
some of the heavy weights discussing this problem. What I can tell,
however, is that it isn't causing problems in any of my code.---Larry
--- TBBS v2.0
* Origin: -*>> [SQUARE-HEADs] HST Multi-Line BBS <<*- QuebecCity (240/1)
*** Part of a conversation.
From: Larry Marshall
To: Bill Leary Msg #122, 02-Jan-89 12:28pm
Subject: Re: SUBST, ADS
Now THAT is a very very good question. I've always wondered why I'm
.>filling out these registration cards since, whever I call them, or do
.>an upgrade, or whatever, they just ask me for a serial number. No
.>check to look it up in the files, no "yep, we've got your registration
.>right here". Nothing that I can detect from any of them.
.>
. When I called to upgrade from 1.5 to 2.0 the guy DID look me up in
the computer. I was there 4 times. He wasn't too sure why. I do own
many of their products but one would think they'd keep track of
multiple entries. At the same time he DID ask me for my serial number
hich, one would think, is staring him in the face. The strange thing
to me is that, in spite of the fact that I've registered a bunch of
their products and my name was in the computer 4 times, I"ve never
received ANY information from them through the mail concerning
upgrades. --- Larry
--- TBBS v2.0
* Origin: -*>> [SQUARE-HEADs] HST Multi-Line BBS <<*- QuebecCity (240/1)
*** Part of a conversation.
From: Larry Marshall
To: Bill Leary Msg #123, 02-Jan-89 12:27pm
Subject: Re: C PROGRAMS
.>is the simplest one. However, the very simplest C program is actually :
.>
.> main(){}
.>
.>which works just fine on every system I've tried and does exactly
.>what you'd expect. Nothing.
.>
. Oh no, not again. Now comes the flood of "no, you've got to put a
";" in there for some compilers........ad nauseum. As someone who can
remember starting out in C (as most of the people asking "what's the
simplest program" questions) I remember having this same thought.
I would bet that the question of "simplest program" from a beginner in
C has nothing to do with main(){}. If you think of it, every
beginner, no matter what compiler has seen the "hello world" example.
That IS NOT the question being asked and yet it generates a stream of
endless msgs regarding something that has little to do with
programming. The next time you see such a question consider who's
asking it. Most likely it's a beginner looking for a programming
project that won't get him in too much trouble with the language.
He's asking, is it easier to write an editor, database manager, etc.
than something else in C. He wants something that won't get him in
too much trouble. How many times would you have liked to tell
a beginner NOT to start learning C by trying to write TSRs? Now's
your chance {grin}.---Larry
--- TBBS v2.0
* Origin: -*>> [SQUARE-HEADs] HST Multi-Line BBS <<*- QuebecCity (240/1)
*** Part of a conversation.
From: Larry Marshall
To: Jimmie Mcdonald Msg #124, 02-Jan-89 12:28pm
Subject: Re: RE: PTR OPERATIONS, MEM MO
.>The addition of the "near", "far", "cdecl", "pascal", etc. keywords is
.>nonconforming. I think that they might (?) be conforming if they began
.>with an underscore - but then again, I'm not so sure, because they
.>change the code emitted by the compiler.
.>
. ANSI compliance is defined by the ability of the compiler to
compile ANSI compatible code correctly. Extensions that the compiler
manufacturer adds to the compiler are irrelevant to this
definition. --- Larry
--- TBBS v2.0
* Origin: -*>> [SQUARE-HEADs] HST Multi-Line BBS <<*- QuebecCity (240/1)
From: Larry Marshall
To: Jim Colligan Msg #125, 02-Jan-89 12:29pm
Subject: Re: C TUTORIAL
.>I've owned Let's C 2.0 & 4.0, Turbo C 1.0, 1.5, & 2.0, and MSC 5.0
.>w/Quick C 1.0. I've gotten rid of Let's C and Quick C and stuck with
.>Turbo. Quick would be my second choice, although I haven't seen Power
.>C or Zortech and those might work for me as well.
.>
. If this sort of proclamation was required with every recommendation
(or denegration) of a compiler, we'd all be better off. --- Larry
--- TBBS v2.0
* Origin: -*>> [SQUARE-HEADs] HST Multi-Line BBS <<*- QuebecCity (240/1)
From: Larry Marshall
To: Stephen Thompson Msg #126, 02-Jan-89 12:29pm
Subject: Re: TURBO C
.>Is there anyway that I can make a room needed for Turbo C (IBM)
.>smaller... I keep running out of memory !!
.>
. What size room do you have it in now {grin}???? Seriously, you
might consider using the commandline version of the compiler rather
than the environment. Using a small editor like QEdit you can run TCC
or MAKE from the editor and this setup will use considerably less
memory.
.
---Larry "knew that large box of manuals would cause complaints"
--- TBBS v2.0
* Origin: -*>> [SQUARE-HEADs] HST Multi-Line BBS <<*- QuebecCity (240/1)
*** This is a reply to #93.
From: Larry Marshall
To: Mike Housky Msg #127, 02-Jan-89 12:30pm
Subject: Re: UNION AND STRUCT
.>You got it right both ways, the important one being that these are
.>defaults which can be changed at compile time. Heh, does this mean
.>that most TC users are running XT-class machines where word-alignment
.>doesn't have a performance cost and MSC users are mainly running
.>AT-class machines where word-alignment pays?
.>
. While I don't think you said what you meant (I think you meant that
XT machines see no performance BENEFIT), I thought I'd ask anyway. Is
there a performance "cost" in some cases? --- Larry
--- TBBS v2.0
* Origin: -*>> [SQUARE-HEADs] HST Multi-Line BBS <<*- QuebecCity (240/1)
*** This is a reply to #23.
From: Larry Marshall
To: Dana P'simer Msg #128, 02-Jan-89 12:30pm
Subject: Re: SUBJECT
.> A more apporpriate echo would be the EDITORS ECHO available at
.>two nodes in Arizona ( I am not sure which ones ) and 2 nodes in
.>Denver ( 104/45 and 104/63, (303)939-9272 ).
.>
. Do you know if this is ever going to make its way onto the
backbone? There's been a lot of complaint about editor discussion
here but until an echo such as this becomes available I don't see how
it's supposed to be a substitute for a backbone echo. Why ISN'T it on
the backbone? Not enough interest?? I doubt it. --- Larry
--- TBBS v2.0
* Origin: -*>> [SQUARE-HEADs] HST Multi-Line BBS <<*- QuebecCity (240/1)
From: Eric Chan
To: All Msg #129, 03-Jan-89 09:13pm
Subject: Directly to screen.
Hi,
Does anyone know how to 'print' something directly on screen,
I am not talking about using BIOS, is directly put the value in the screen
buffer.
Thanks.
Eric.
--- ConfMail V3.31
* Origin: [ The Nameless BBS ] (416)638-7737 * (1:229/5)
From: Zero Eagle
To: Daniel Lyke Msg #130, 03-Jan-89 03:43pm
Subject: Re: Code Generators
" > Thanks for the reply, but what I am looking for is a
" > program which will allow me to paint screens, design
" > data layouts and generate the code to create a new
" > program. I have heard a lot of good things about Pro C,
" > but since they never advertize the price I assume it is
" > astronomical.
"
" Pro C goes for somewhere in the $500 range, I think. It sounds
" like you should take a look at THEDRAW (THEDRAW*.ARC from
" 1:362/101), which is a shareware package that allows you to paint
" screens, then save them in a variety of formats (Various Binary,
" ANSI, ASCII, etc). Then you could write a routine to load those
" screens (either from memory or disk), and put in your own data
" entry routines. It wouldn't be as easy as Pro C, nor as complete
" (Pro C does the database call up code and other stuff, I've got
" the demo disk around here somewhere), but it'd be a lot cheaper.
Have you ever seen/used "The BOSS", a window library for 'C'? It
works with MSC, Quick C, Turbo C, and a few others that have
slipped my memory. The windowing part of the program is pretty
sophisticated (works on all screen types, uses layered windows, etc),
and the data-entry routines are great.
FReq. BOSS_???.ARC from 1:148/314 (8am -> Midnight ONLY) if you're
interested.
--- Ned 1.01
--- ConfMail V4.00
* Origin: _*~ The Fowl Weather Post ~*_ &Fowl_Weather_Post=148314; /* Opus
*/ (1:148/314)
*** Part of a conversation.
From: Bryan Ackermann
To: Jon Guthrie Msg #131, 04-Jan-89 12:54pm
Subject: Re: Turbo vs. 2.0
I believe that Turbo 2.0 is available in "regular" (no debugger) and
"professional" (debugger included) versions...
---
* Origin: Rymalee's Refuge (Opus 1:159/400)
*** Part of a conversation.
From: Ted Carroll
To: Ron Warris Msg #132, 04-Jan-89 05:05pm
Subject: Re: gettext()
Ron -
Yes it is possible to use dynamic allocation for storage of the
information from gettext(). Actually on page 90 of the turbo C 1.5 manual
(2.0 works the same) is the formula bytes = (h rows) * (w .
bytes = rows * columns * 2; - if you want an explination of
why this is valid just drop me a line. anyway then after
you have the number of bytes required you can allocate them with malloc as
follows in this code fragment.
.
.
if(!(ptr = (char *)malloc(bytes)))
{
printf("Put of memory error in window allocation\n");
exit(1);
}
.
.
I'm glad that somebody else is using turbo C - it's great, and I
wouldn't trade it for 100 copies of MSC - if you have any other questions just
drop me a line.
.
.
.
Ted Carroll(a.k.a. Alexander Nevermind, Flyboy)
--- QM v0.17
* Origin: /* The AULT-erNET Solution (317)743-5441 HST */ (1:201/40.0)
*** Part of a conversation.
From: Ted Carroll
To: Bob Stout Msg #133, 04-Jan-89 05:27pm
Subject: Re: Ctl-C/Break
Bob -
Does that actually disable the Ctl-C/Break of does that just "undo" what
break on does.
-Ted(a.k.a. Alexander Nevermind, Flyboy)
--- QM v0.17
* Origin: /* The AULT-erNET Solution (317)743-5441 HST */ (1:201/40.0)
*** Part of a conversation.
From: Richard Chadwell
To: Lyle V. Rains Msg #134, 04-Jan-89 10:50pm
Subject: Clean Code
Referencing your work, we liked what your into and have seen your
Clean Code and hope that you will contact us at (216) 449-6104 (V).
---
* Origin: PC-OHIO II HST (216-291-3048) (Opus 1:157/200)
From: Bill Graham
To: Jeff Bauer Msg #135, 04-Jan-89 02:21pm
Subject: Re: NON-ANSI C
>I need to maintain compatible source between some ANSI and non-ANSI
>C environments...
>My approach would be to place the prototypes in the header files
>and use AWK to move the variables outside the function parentheses
>i.e. int doit(int cnt, char *str) {
> ...
> }
>BECOMES int doit() {
> int cnt;
> char *str;
> ...
> }
>Does anyone have a better idea?
>
Perhaps I am missing something here. Those two functions are _not_
the same. The first function is passed two values. The second
function creates two automatic variables which are uninitialized
(not the same as as what seems to be the intent of the first function,
which is to be passed two values).
Is there more happening here than concern with ANSI compatibility?
--- TBBS v2.0
* Origin: TechTalk BBS ,Titusville,FL,407-269-5188,4-HST's (374/1)
*** Part of a conversation.
From: Martin Maney
To: Jeff Bauer Msg #136, 04-Jan-89 09:59am
Subject: Non-ANSI C
JB> I need to maintain compatible source between some ANSI and non-ANSI
JB> C environments. The code hasn't been written yet (thankfully I
JB> get to plan ahead on this project), so I want to do it right.
You might want to dig up the July 88 issue of Computer Language: there's an
article about an ANSI compatible preprocessor. This wouldn't solve all your
problems, but may be of value. Executable for MS-DOS is said to be available
from the CL BBS (list in every issue) or their Compu$erve forum. Sources
available from the authors (Steven Williams and Kent Williams).
Brewster Station
PO Box 8458
Bridgeport, Conn. 06605
This doesn't directly address the prototype problem, but I think that having a
consistent preprocessor for the different compilation environments would also
be of great help in your endeavor.
/\/\artin
--- msged 1.94S ZTC
* Origin: Mind is Moving [Palatine, IL] (1:115/790.3)
*** Part of a conversation.
From: Bob Stout
To: Paul Allen Msg #137, 05-Jan-89 09:00pm
Subject: zortech, c++
Paul...
C++ is a superset of ANSI (as proposed) C. A C++ compiler will compile a C
program, but not vice versa. Most current implementations of C++ are, in fact,
merely preprocessors that turn C++ source code into C source code. The Zortech
C++ compiler for PC's is one the first native code C++ compilers available.
Object-oriented programming is a philosophy that providse for a greater
degree of data abstraction than is possible with non-OOPS languages such as C.
Or another way of looking at it is that Forth and other languages made
"extensible" a dirty word when used to describe a programming language, so
once the rest of the world caught on that it's really a good idea if done with
a little discipline, they had to think of something else to call it!
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** Part of a conversation.
From: Bob Stout
To: Braden Claxton Msg #138, 05-Jan-89 09:13pm
Subject: Re: Non-ANSI C
In a message of <04 Jan 89 20:58:09>, Braden Claxton (1:106/112) writes:
>What does the acronym AWK mean? I have never seen that one before.
Braden...
AWK is a text processing language written by messrs. Aho, Weinberger, and
Kernighan (the `K' of K&R) - ergo "AWK".
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** Part of a conversation.
From: Bob Stout
To: Jon Guthrie Msg #139, 05-Jan-89 09:14pm
Subject: Re: Linefeed in TurboC
In a message of <01 Jan 89 20:29:01>, Jon Guthrie (1:14/627) writes:
>If the run-time library converts all the LineFeed characters (people
>keep referring to them as 'Newline' characters, but none of my ASCII
>tables has any character named NewLine in them) to CR/LF pairs, then
>your bit of subterfuge will not work, either.
Jon...
<sigh> You're right of course - Oh well, every so often (some would say all
too often or even most of the time) I start getting careless and rattling off
gibberish off the top of my head.
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** There is a reply. See #159.
From: Bob Stout
To: Larry Marshall Msg #140, 05-Jan-89 09:19pm
Subject: Re: LEARNING C
In a message of <01 Jan 89 11:01:55>, Larry Marshall (1:240/1) writes:
LM> I just applied for a job at the University of Houston; does everybody
LM> write like that?
Larry...
You think we write funny, wait til you hear us! :-) Anyway, if you get the
job or even get to fly in for an interview, give me a call (i.e. have your
machine call my machine, we'll do lunch :-)
BTW, I just talked to Steve Margison this evening and it appears the ZTC++
library is a go. I'm going to send him off a couple of revisions this weekend
along with some notes and revised documentation and will try to get you a copy
off as well. After that, give him a few weeks for his wife to get over her
surgery and it should be about ready for all the Zortechies of the world!
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** Part of a conversation.
From: Bob Stout
To: Ming Mar Msg #141, 05-Jan-89 09:38pm
Subject: Benchmarks! please D
In a message of <02 Jan 89 17:41:27>, Ming Mar (1:167/136) writes:
>On Christmas Day you posted a message to Heikki Suonsivu in which
>you say:
>
> > Hey, you don't suppose you can cut some of this crap out, could
> > you?
> >
> > If I wanted to be in UseNet, I'd be in usenet.
>
>Hmmm. Santa must've put a lump of coal in somebody's stocking.
Ming...
Obviously you don't know Randall as we do - Santa doesn't go down this guy's
chimney, he heads straight for the coal chute! :-)
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** This is a reply to #83.
From: Bob Stout
To: Bill Leary Msg #142, 05-Jan-89 09:28pm
Subject: Re: CTL-C/BREAK
Bill...
Quite true - which is why signal() or specialized ctrl-break handlers are
still the preferred route.
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** Part of a conversation.
From: Bob Stout
To: Bill Leary Msg #143, 05-Jan-89 09:29pm
Subject: Re: PRODUCTIVITY
Bill...
In a world of BBS's, one of the greatest advantages of the .COM format is
its physically smalller size which translates into faster downloads.
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** Part of a conversation.
0;36mFrom: Rick Roth
To: All Msg #144, 04-Jan-89 03:07pm
Subject: Terminfo curses
Hy there i was wondering is someone can help me with a problem I am having
with terminfo curses. How can you send 8 bit characters to the
terminal. In the example below under termcap curses calling the function
outlines the window in IBM type graphic characters, under terminfo curses
the output has the 8th bit stripped giving inverted alpha numeric characters.
void ibm_box(win)
WINDOW *win;
{
box(win,179,196);
mvwaddch(win,0,0,218);
mvwaddch(win,0,win->_maxx-1,191);
mvwaddch(win,win->_maxy-1,0,192);
mvwaddch(win,win->_maxy-1,win->_maxx-1,217);
}
If anyone can help it would be appreciated.
Thanks Rick Roth
--- ConfMail V4.00
* Origin: TECHbooks_One, Portland, OR +1(503)760-1473 G (1:105/4)
From: Gary Lau
To: Martin Pollard Msg #145, 04-Jan-89 05:24pm
Subject: Re: Mix Power C
>Howdy, all. I'm new to the C Echo (but only relatively new to C), and
>I've got some questions. Who amongst you uses Power C from Mix Software?
I do!
> I have a few stumpers about it:
>
>1) My version of the compiler is 1.16. Is there a later version out?
> I didn't get a registration card of any kind with mine (purchased
> directly from Mix), and I haven't been notified of any changes.
I didn't get any registration card of any type either. The version I
received just before the Christmas holidays is 1.2.0
>2) Has anyone been able to compile using the small and large memory
> models? I can only compile with the medium model. In fact, I can
> recall a review in one of the big magazines in which the reviewer
> stated that he couldn't get small/large to work, either.
I've been able to compile in the small model. Haven't tried compiling
in the large model. Were you getting error messages?
>3) How do you feel about Power C? Likes? Dislikes?
The only C compilers I've used is Power C and TC 2.0. My background in
C is limited so I'm not in a position to fully comment on Power C. I
have read that Power C is a not a good compiler to use for heavy duty
programming. But, I do like the Power C manual.
--- Via OpXpress V1.03ß Ahead Warp 1 with Opus Xpress!
* Origin: House Atreides (818)965-7220HST (1:103/602)
*** Part of a conversation.
From: Henry Piper
To: Bob Stout Msg #146, 05-Jan-89 05:50pm
Subject: ZortechC
I finally got hold of Sam at Zortech, he got everything straightend out with
no problems. I guess I'm going to have to find room for ZTC on my hard disk
again. P.S. How do you like your BBS.
--- Opus-CBCS 1.10.v
* Origin: Crystal Palace The Ghost in the Machine (1:382/1.0)
From: Roland Brown
To: Bryan Ackermann Msg #147, 06-Jan-89 02:27pm
Subject: Re: Turbo vs. 2.0
> I believe that Turbo 2.0 is available in "regular" (no
> debugger) and "professional" (debugger included) versions...
>
>
Turbo 2.0 "Regular" to use your term DOES have a debugger for the integrated
enviornment. It is "slightly" limited compared stand alone debugger that
comes with the Professional version. The professional version also includes
TASM which is the Turbo Assembler. From what I have seen the Integrated
debugger is more than sufficient for most projects. The standalone is
unbelievable with options to debug:
Codeview modules
virtural modes for 80386 machines
remote debugging over serial port with a second computer
and a bunch of other "Bells and Whistles"
roland
---
* Origin: Sky Pilot Point Mail Box Off 261/1004 (Opus 1:26102/4)
*** Part of a conversation.
From: Bob Stout
To: Mike Housky Msg #148, 06-Jan-89 07:51am
Subject: Re: Ctl-C/Break
In a message of <03 Jan 89 22:42:43>, Mike Housky (1:103/522.6) writes:
> I suspect the next sound I'll hear will be a loud blush from the Great
> Soutwest!
Mike...
My blushes may be colorful, but rarely noisy! :-) Seriously, the ZTC
dos_set_cntl_break() is exactly as you suspect - it calls DOS (hence the "dos"
in its name) to enable/disable Ctrl-Break checking. This is exactly what I
understood Patrick to want. It may be more robust to intercept the Ctrl-Break
interrupt (even with a do-nothing handler), but that isn't what I understood
he wanted.
Bob (color me still blushless) Stout
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** Part of a conversation.
From: Bob Stout
To: Mike Housky Msg #149, 06-Jan-89 08:02am
Subject: Re: TC 2.0 woes
Mike...
TCC (command line TC) doesn't "degrade gracefully", it merely takes larger
programs to get an "out of memory" error.
______________________
/__ __ __ __
__/ / /_/ /_/ /
/_____________________________________
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** Part of a conversation.
From: Bob Stout
To: Larry Marshall Msg #150, 06-Jan-89 08:06am
Subject: Re: C PROGRAMS
In a message of <02 Jan 89 12:27:53>, Larry Marshall (1:240/1) writes:
>He's asking, is it easier to write an editor, database manager, etc.
>than something else in C. He wants something that won't get him in
>too much trouble. How many times would you have liked to tell
>a beginner NOT to start learning C by trying to write TSRs? Now's
>your chance {grin}.---Larry
Larry...
Frankly, my urge, when I see these "simplest program" messages, is to
suggest they write a real-time, multi-user, multitasking operating system! At
least it would give them something to do for a few years besides enter
insipid, pointless messages here for the rest of us to groan and wade through.
Bob (main() { printf("Say \"goodbye, world\"!\n"); }) Stout
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** Part of a conversation.
From: Bob Stout
To: Ted Carroll Msg #151, 06-Jan-89 08:14am
Subject: Re: Ctl-C/Break
In a message of <04 Jan 89 18:27:53>, Ted Carroll (1:201/40) writes:
> Does that actually disable the Ctl-C/Break of does that just "undo"
>what break on does.
Ted...
It's just a handy way of doing "BREAK ON" or "BREAK OFF" from within a
program - which is sometimes all you need or want.
--- msged 1.96S ZTC
* Origin: Stoutbound Traffic (Imagine a witty phrase here) (1:106/506.6)
*** Part of a conversation.
From: John Moore
To: All Msg #152, 05-Jan-89 06:30pm
Subject: Windchill
I have lost the name of the person wanting a windchill formula, but maybe this
will help:
#include <math.h>
float wind_chill(int wind_speed, int temp
{
return (((10.45 + (6.686112 * sqrt((double) wind_speed))
- (.447041 * wind_speed)) / 22.034 * (temp - 91.4)) + 91.4);
}
--- Opus-CBCS 1.10.v
* Origin: Centurion OPUS/HST, Stone Mountain, GA (1:133/302.0)
*** Part of a conversation.
From: Joubert Berger
To: All Msg #153, 02-Jan-89 12:59pm
Subject: declaring variables
I have a question. Is it possible to declare a variable at an absolute
address -- in Modula2 you can say "screen[b800h]" to have the variable
screen located at b800. Can this be done in C?
Joubert
--- Opus-CBCS 1.10.v
* Origin: NASPA Systems SE Hayes 9600 404/441-1431 (1:133/301.0)
*** There is a reply. See #192.
From: Tom Vaughan
To: Bill Leary Msg #154, 05-Jan-89 10:20pm
Subject: ESCAPE CODES TO PRINTER
Bill, while recreating the code that locks up my printer, I was able to
correctly answer my own question.
#include<stdio.h>
main()
{
fprintf(stdprn,"\33\105");
fprintf("this text will be EMPHASIZED");
}
Thanks for your reply.
---- Tom
--- via XRS 0.99
* Origin: From the Harbor in Charleston -- Tom Vaughan (TComm 1:372/888.22)
From: Paul Roub
To: Randall Smith Msg #155, 06-Jan-88 01:09am
Subject: Re: Debugger.
-> DN> I would state that their is NO professional programming
project
->today that DN> doesn't use a debugger, if one is available. Period.
->How about Lotus 123 Version 3.0? <BIG grin> Later... Randy.
->Lotus 123 Version 3.0 >>someday.
->
well - it's not that they don't WANT to use a debugger - they just
can't find one with negative memory requirements!
-paul
--- Via OpXpress V1.03ß Paul Roub and his all-girl orchestra
* Origin: MOBS_Opus_Humor_South~Only you can prevent Echo Fires (Opus
1:135/47)
*** Part of a conversation.
From: Dan Norstedt
To: Mike Housky Msg #156, 03-Jan-89 02:26pm
Subject: Re: Debug info packing
> ... and ever since MS LINK started supportiing automatic
> packing with /EXEPACK I haven't paid much attention to it.
Note that EXEPACK and LINK /EXEPACK doesn't give identical results
(with EXEPACK marginally better). Don't know why, just observed it.
You have found out to use the LINK switches /FAR and /PACK for production
code, though? (If not, try it. It's only a few % and only has effect on
medium model and up, but it's for free.)
--- ConfMail V4.00
* Origin: Dan Norstedt, Stockholm - Sweden (2:202/204.2)
From: Dan Norstedt
To: Chris Crowe Msg #157, 03-Jan-89 03:24pm
Subject: Re: drive check -- orig 11/4/88
> Do you know how to determine if the drive is assigned or subst?
You probably can't. But I fail to see when it's necessary to detect, because
far as I can see, you can ask DOS about the assigned or subst drive just as
well as the real drive.
> Some program would do catastropic things if you tried to read and write
> from drives that don't really exist.
Well, I don't think to highly of programs that blow up when a floppy door
is opened when it's running. I think the solution is in trapping the errors,
instead of imposing static environments.
> Does anyone else have a routine to detemine if a drive exists?. How about a
> person from MICROSOFT, any here?, do you have an answer?
DOS have a routine that (among other things) can tell you if a drive is VALID.
Read the docs for int 0x21, function 0x29.
I have published a routine in this echo that determined if a drive is READY,
using only documented DOS calls. If you can't find it, maybe I can rerun them.
--- ConfMail V4.00
* Origin: Dan Norstedt, Stockholm - Sweden (2:202/204.2)
From: Mats Wallin
To: Mats Sjoblom (Sesam Pryo) Msg #158, 03-Jan-89 07:55pm
Subject: DMS/32
Congratulations to your success :-)
> and a relation database manager written in Cobol, with no C
I thought it was written in Pascal, that's what you told me. (And a database
manager, written in Pascal, with no Pascal interface :->
/mats
--- FD TosScan .15
* Origin: Mats Wallin - Telsoft - Stockholm - Sweden (2:202/204.3)
From: Mats Wallin
To: Mike Housky Msg #159, 03-Jan-89 08:06pm
Subject: Re: Linefeed in TurboC
> formfeed character (^J, 0x0A)
FormFeed = ^L = 0x0C
LineFeed = ^J = 0x=A
/mats
--- FD TosScan .15
* Origin: Mats Wallin - Telsoft - Stockholm - Sweden (2:202/204.3)
*** Part of a conversation.
From: Gottfried Ganssauge
To: Petri Helenius Msg #160, 02-Jan-89 10:37am
Subject: Re: Packing Structures
> 68020 aligns to word, not longword. 68020 can address longwords
> equally
> efficent at word and longword boundaries, so there is really no need to
> align to longwords! I don't know about 80386, because I don't do
MC68020 User's Manual 2nd Edition page 5-10:
"Some performance degradation can occur due to the multiple bus accesses that
the MC68020 must make when long word (word) operand accesses do not fall on
longword (word) boundaries."
Hope that clears things up,
Ciao, Gottfried
--- ConfMail V4.00
* Origin: Gotti's AT (2:245/1000.35)
From: Felix Kasza
To: Robert Mccullough Msg #161, 03-Jan-89 02:59pm
Subject: Re: Interfaces
RM> [...] The second is C-Tree by Faircom. This is a B-TREE file system in
RM> C. [...] All you do is compile it under your favorite compiler.
While I like c-tree very much, I cannot fully agree with you. The set
functions are rudimentary to non-existent (although r-tree does some cute
tricks in that direction), and the 8-bit character handling (for key sorting)
is as much a mess as is the parameter file stuff for the ISAM routines.
But otherwise, it really is a fine product.
Felix.
--- msged 1.943L MSC
* Origin: The Beast (fidonet 2:310/11)
From: Felix Kasza
To: All Msg #162, 03-Jan-89 03:06pm
Subject: Greg McCann's netmail address
Sorry to bother you with an off-topic message, but I desperately need Greg
McCann's netmail address (somewhere in Chattanooga, TN?), and he hasn't shown
up lately. If you do know it, please send netmail ... one off-topic msg is
enough.
Thanks a lot,
Felix.
--- msged 1.943L MSC
* Origin: The Beast (fidonet 2:310/11)
From: Felix Kasza
To: Elizabeth Elliott Msg #163, 04-Jan-89 10:44pm
Subject: MSC execl() with DOS 2.x
In a message of <31 Dec 88 21:16:12>, Elizabeth Elliott (1:106/112) writes:
[About problems executing other programs]
Elizabeth,
there is always an elegant method (exec..(), in this case), and then
there's the Microsoft-required method. If you really can't get it to work with
Macro-Cruft's Dumb Offending System 2.xx, you might try the following: Invoke
your program from a batch file; then scan the batch file for the line where
your program is invoked; then advance to the start of the next line; truncate
there; and append the command lines for whatever else you want to do. This
should do the trick, and, yes, this kludge is about as crufty as kludges can
get. Makes you [how do you say "throw up" in a polite way?] ... but then so
does MS-DOS :-)
Felix.
P.S.: Reconsidering, please delete the smiley face after "MS-DOS": I believe
it's not a joke but the bitter truth.
--- msged 1.96S ZTC
* Origin: The Beast (fidonet 2:310/11)
From: Felix Kasza
To: Daniel Lyke Msg #164, 04-Jan-89 10:58pm
Subject: Re: Reverse-Video
In a message of <31 Dec 88 01:39:34>, Daniel Lyke (1:362/101.2) writes:
[To change video attribs]
>char far *screen = (char far *)0xb8000000;
>for(i=0;i<8192;i+=2) screen[i] ^= (char)(0xff);
Now I might be wrong, but I think your last statement should read:
for ( i = 1; i < 4000; i += 2 )
screen[i] ^= '\377';
First, attributes occupy the *high* byte -- that's why my loop starts at
1, so it processes attribs instead of characters; and second, the screen
(usually!) is 80*25*2 bytes long == 4000. Anyway, you shouldn't hard-code that
stuff but query the OS/BIOS/whatever for screen mode (gives you the base
address) and screen size.
Felix.
--- msged 1.96S ZTC
* Origin: The Beast (fidonet 2:310/11)
From: Felix Kasza
To: Dan Norstedt Msg #165, 05-Jan-89 12:09am
Subject: far *
In a message of <01 Jan 89 20:16:40>, Dan Norstedt (2:202/204.2) writes:
>In a OS/2 device driver, selector 0x0040 is always pointing on physical
>address 0x000400... <keeping a strait face> OS/2 isn't PC-specific...
You mean you still haven't trashed your copy?
Felix.
--- msged 1.96S ZTC
* Origin: The Beast (fidonet 2:310/11)
From: Reiner Kunz
To: R.j. Devan Msg #166, 05-Jan-89 01:31am
Subject: C for the IIGS
> Looking for a good C compiler that makes use of the IIGS' features. Any
> ideas anyone?
>
Hi,
one year ago I wrote a book about this rather disappointing machine. Fantastic
Music chip, nice graphics, nice MAC-like operating system, powerfull processor
but artificially slowed down by apple to protect it from getting market shares
of the Ol' Mac (sigh).
To get a C-Compiler just buy the IIGS-developers-environment. I think it's
called APW - Apple Programmers Workshop (or something). Within you'll get the
fabulous Megamax-C-Compiler which is really a slow. So you might get gray hair
waiting for a complete comiplation. So get your hands on a RAM-expansion and a
harddisk. Using only disk would quite frustrating. Indeed, the megamax
C-Compiler is the only C I know for this machine and I could only use the
soon-to-be-released Gamma-Version (or so).
Good luck and see you on the bitstream !
cu Reiner
--- ConfMail V3.3
* Origin: UNIX and C spoken at: (2:507/414.4)
*** This is a reply to #87.
From: Paul Schlyter
To: Heikki Levanto Msg #167, 05-Jan-89 10:08am
Subject: ^Z
> Does anyone have a good explanation why MS-DOS has so much fuss with the
> eof character, and some other operating systems don't ? How does Unix
> for example know when the file ends. ( it is easy enough if the length is
> saved in the directory, but what about files coming from keyboard / modem
> ? )
This is a legacy from CP/M-80, which only allowed file lengths to be an
even multiple of 128. In CP/M-80, text files were filled at the end
with ctrl-Z, up to the next 128-byte boudary (although some programs,
e.g. Microsoft's, only wrote one ctrl-Z and filled the rest of the remaining
space with NULs).
To be upwardly compatible with CP/M-80, MS-DOS also allowed text files to
be terminated with ctrl-Z. Some early MS-DOS programs (for instance WordStar)
always the transmission. Printable values (between
be larger
than 64KBut since MS-DOS also allowed you to specify an exact file length, this
was an alternate method of telling where the end of a text file was. No
ctrl-Z at the end is then necessary.
s at all (if your program has
any data, whict choice.
For profe, some
programs append no ctrl-Z, some programs append one ctrl-Z, and a few old
programs append ctrl-Z:s up to the next 128 byte boundary. When reading,
a well-behaved MS-DOS program should accept both text files that ends
with a ctrl-Z and those who do not. However, some programs always expects
a ctrl-Z at the end and behavre, but where will you get it?"
Kamenz
[Klater..
Jerry
--- Ms it belongs to the text.
--- FD TosScan .15
* Origin: Paul Schlyter, Stockholm, Sweden (2:501/237.4)
From: Paul Schlyter
To: Mats Sjoblom (Sesam Pryo) Msg #168, 06-Jan-89 08:05am
Subject: New C'er
> You see (pun intended) - all the data structuring possible in Pascal is
> readily translatable to C, not so strange since they sprung from a
> commonsource - the Algol family.
Well, C is actually a mixture, also having a lot of heritage from Assembler
and Fortran. Everybody knows that C is half-way assembler, but most people
seem to be unaware of the similarities between Fortran and C. So, here's a
few things that both C and Fortran has, but is missing in Algol and Pascal:
- Static variables (also local var:s in functions)
- Variables can be given initial values
- No type-checking of function arguments (K&R C; possible in ANSI C)
- Separate compilation as a standard feature of the language
- Both single and double precision f.p. variables (no complex var:s though)
K&R C only has double arithmetics; ANSI C allows float arithmetics too
- Formatted input and output
- Equivalence/union (can be simulated with variant records in Pascal)
- No nested functions
--- FD TosScan .15
* Origin: Paul Schlyter, Stockholm, Sweden (2:501/237.4)
From: Paul Schlyter
To: Mats Sjoblom (Sesam Pryo) Msg #169, 06-Jan-89 07:18am
Subject: "C"
> Ah - word definitions. So - mainframe means "macro computer" does it? I
> always used it for mini:s as well - anything not based around a micro
> CPU.
A micro computer can be put on a table; a mini computer can be put in a
closet; a mainframe computer requires a room.
--- FD TosScan .15
* Origin: Paul Schlyter, Stockholm, Sweden (2:501/237.4)
From: Paul Schlyter
To: Heikki Levanto Msg #170, 06-Jan-89 07:24am
Subject: Re: C AND UNIX
> > to send 7 bytes of binary data, if all data bytes have values
> > between 80h and 9Fh.
> ^^^ FFh
Nope, that was NOT a mistake.
If Kermit transmits a data value between 00h and 1Fh, this must be quoted
as a control char, and then the actual value will be transmitted as a
printabl char.
If Kermit transmits a data value between 80h and FFh, this must be quoted
as a char with the high bit set, and then the actual value will be
transmitted with the high bit clear.
If Kermit transmits a data value between 80h and 9Fh, when the high bit is
cleared, it will become a contrl char. Therefore it must be doubly quoted,
as a control char with the high bit set.
Therefore, data values between 80h and 9Fh requires three bytes in the
transmission. Data values between 00h and 1Fh, and also between A0h and
FFh requires only two bytes in the transmission. Printable values (between
be larger
than 64K.
The basic difference is that .COM files can only use one segment (of
up to 64K), while .EXE files may use any number of segments. In OS/2
protected mode, you cannot use .COM files at all (if your program has
any data, whict choice.
For professional programming it is becoming a less viable choice.
Inexpensive compiler, inexpensive library source, the best book on C I've seen
yet, what more could you ask for?
Mix Software is in Texas at 1-800-523-9520.
Just the book and source are worth the cost.
George "okay... you might want to ask for more, but where will you get it?"
Kamenz
[Klater..
Jerry
--- Msg V3.2
--- ConfMail V3.31
* Origin: I'm glad you pointed that out to me.. (1:130/24.814)
*** This is a reply to #150.
From: David Powell
To: All Msg #180, 06-Jan-89 01:38am
Subject: TURBO C GRAPHICS
I have Turbo C v.1.0.
I've read a little about Turbo C v. 2.0 - but haven't learnt much about my
main interest - the level of support for graphics (for the IBM-PC video modes
- say, CGA and EGA). Can someone summarise what they're doing with graphics
functions? I'd like to play with music staff notation.
---
* Origin: Lodestone: The things you find under WOC's! (Opus 3:711/407)
From: Mike Bourne
To: Mike Vore Msg #181, 02-Jan-89 09:47pm
Subject: Re: PROGRAM FILENAMES
JG> Micro Cornucopia is a VERY good (and a little
JG> off-the-wall, one of their
JG> columnists writes articles concerning the state of the
JG> computing art in TURKEY,
JG> of all places) computer magazine.
MB> NOW THIS I'm interested in! Is this a consistent feature or was it
MB> in a particular issue.
MB>
MB> (I've been wondering how to justify getting them to
MB> pay for a
MB> subscription to Micro Cornucopia...)
MV> At only $18 a year it is a real bargin, If you can
MV> swing a subscription yourself then YOU can keep the
MV> copy and not have anyone in the office walk off with
MV> it!
MV> - mike
The problem is that right now I *can't* swing the subscription myself. We
bought a new house in Oct 87 and still haven't unloaded the old one yet.
Sixteen months of two house payments have been tough. The market is not too
good here in Texas. We do have a contract, though, and should close in March.
I took a look at Micro C in the bookstore a couple weeks ago. I wish that I
could figure out some way... Maybe in March.
Mike Bourne
--- ConfMail V3.2
* Origin: A Point at the Edge of Town (Ft. Worth, TX) (1:124/5208.904)
From: Wayne Hamilton
To: Randall Greylock Msg #182, 06-Jan-89 12:17pm
Subject: Re: COMPUTING ADDRESS OFFSETS WITHIN
> Earth to moonbase everyone! I DON'T WANT TO DO THIS AT RUN TIME!
>
what's the big deal? this compiles cleanly under TC and runs fine; is it the
sort of thing you had in mind?
struct foo1 {
char a;
int b;
double c;
short d;
};
struct foo2 {
char *var;
int off, siz;
} foo2[] = {
/* note: this begs for a macro... */
{ "a", (int) &(((struct foo1 *) 0)->a), sizeof(((struct foo1 *) 0)->a) },
{ "b", (int) &(((struct foo1 *) 0)->b), sizeof(((struct foo1 *) 0)->b) },
{ "c", (int) &(((struct foo1 *) 0)->c), sizeof(((struct foo1 *) 0)->c) },
{ "d", (int) &(((struct foo1 *) 0)->d), sizeof(((struct foo1 *) 0)->d) }
};
main(void)
{
int i;
for (i = 0; i < (sizeof(foo2) / sizeof(foo2[0])); ++i)
printf("foo1.%s is %d bytes at offset %d\n",
foo2[i].var, foo2[i].siz, foo2[i].off);
}
output is:
foo1.a is 1 bytes at offset 0
foo1.b is 2 bytes at offset 1
foo1.c is 8 bytes at offset 3
foo1.d is 2 bytes at offset 11
--- ConfMail V3.31
* Origin: The Programmer's Toolbox HST (1:232/400)
*** Part of a conversation.
From: Wayne Hamilton
To: Kirby Angell Msg #183, 06-Jan-89 12:04pm
Subject: Re: reading the 'command line'
> The first argument (in argv[]) is the name of the program only in DOS
> versions 3.3 and above. In previous versions (depending on the compiler
> but generally) argv[0] == NULL.
>
that should be 3.0 and above.
^
--- ConfMail V3.31
* Origin: The Programmer's Toolbox HST (1:232/400)
*** Part of a conversation.
From: Jimmie Mcdonald
To: Larry Marshall Msg #184, 06-Jan-89 06:51pm
Subject: ANSI conformance of MSC
To be ANSI conformant, a compiler MUST correctly compile ANY
ANSI conformant program, including the following one:
void far(
{
return 1;
}
main()
{
(void) far();
}
. I
which Microsoft C 5.1 will not do in its default mode, It will do
it only if you give it the /Za switch.
The point is that compilers to be conformant MUST NOT usurp ANY
POSSIBLE user defined variable or function name. Names beginning
with an underscore are NOT ALLOWED to be used by conforming programs,
but MAY be used by additions to a vendor's library. I am not
sure whether or not vendors are allowed to add KEYWORDS beginning
with an underscore.
Doug McDonald
--- ConfMail V3.31
* Origin: StageDoor -- U.S. Inst. for Theatre Technology (1:233/3)
From: Larry Marshall
To: Bob Stout Msg #185, 04-Jan-89 06:51pm
Subject: Re: PRODUCTIVITY
.> I just DL'ed Qedit 2.07. I still like EC's column blocks better, but
.>Sammy's obviously been doing his homework. BTW, I talked to the author
.>of EC the other day and the next version will include a directory
.>picker, EGA/VGA support, and virtual memory ("virtual is its own
.>reward!" :-)
.>
. Here's one to show my ignorance (again). What is to like or
dislike about column blocks??? IT would seem that you either can
block columns or you can't. What's the difference? --- Larry
--- TBBS v2.0
* Origin: -*>> [SQUARE-HEADs] HST Multi-Line BBS <<*- QuebecCity (240/1)
*** Part of a conversation.
From: Larry Marshall
To: Dan Norstedt Msg #186, 04-Jan-89 06:52pm
Subject: Re: DEBUGGER.
.> > hide) any symtoms (sp?) while the search progresses. Further, most
.> > bugs can be traced back to their cause without a debugger.
.>
.>I would state that their is NO professional programming project today
.>that doesn't use a debugger, if one is available. Period.
.>
. Thanks for your deeeeep insight. You must look over the shoulders
of a lot of people. Do you really think your statement should be
taken as fact???? --- Larry "just the facts please" Marshall
--- TBBS v2.0
* Origin: -*>> [SQUARE-HEADs] HST Multi-Line BBS <<*- QuebecCity (240/1)
*** Part of a conversation.
From: Larry Marshall
To: Bob Stout Msg #187, 04-Jan-89 06:52pm
Subject: Re: HELLO.
.>DG> Briefly, how is C different from Pascal, to the best of your
.>DG> knowledge (11 lines or less please)
.>
.>Terser++.
.>
. Got my debugger going Bob. Shouldn't that be -> Terser++;
. ---{grin()}---Larry "thanks for the present"
--- TBBS v2.0
* Origin: -*>> [SQUARE-HEADs] HST Multi-Line BBS <<*- QuebecCity (240/1)
*** Part of a conversation.
From: Roy Tellason
To: Jon Guthrie Msg #188, 06-Jan-89 04:29pm
Subject: Re: Linefeed in TurboC
BS> 1. Open the output stream in binary mode.
BS> 2. Use '\012' (octal) or '\x0a' (hex) to explicitly enter
BS> the character.
> If the run-time library converts all the LineFeed characters
> (people keep referring to them as 'Newline' characters, but
> none of my ASCII tables has any character named NewLine in
> them) to CR/LF pairs, then your bit of subterfuge will not
> work, either.
Yeah, but that's the point of opening in binary mode, in which such
conversions should not take place. "Newline" is not defined in terms
of a specific ascii character, either. It's actual machine
representation will vary from one system to another.
--- Opus-CBCS 1.10.0f
* Origin: The Other BBS (1:150/501.0)
*** This is a reply to #159.
From: Bill Leary
To: Bob Stout Msg #189, 05-Jan-89 05:20pm
Subject: Re: WINDCHILL
How about, to stay in line with the purpose of this conference, I put the
program the implements the thing in here. Or is that not the purpose of the
conference? Moderator : HELP !
--- TBBS v2.1
* Origin: Cul-De-Sac Bar & Grill *SeaDog 4.5 & HST* 508-429-8857 (322/360)
*** This is a reply to #152.
From: Bill Leary
To: Randall Greylock Msg #190, 05-Jan-89 05:27pm
Subject: Re: COMPUTING ADDRESS OFFSETS WIT
Sorry. I thought you WANTED it computed at RUNTIME rather than COMPILE time.
I've no idea how to solve it for compile time.
--- TBBS v2.1
* Origin: Cul-De-Sac Bar & Grill *SeaDog 4.5 & HST* 508-429-8857 (322/360)
From: Bill Leary
To: Dan Norstedt Msg #191, 05-Jan-89 10:46pm
Subject: REPLY TO DEBUGGER MESSAGE
DN> I would state that there is NO professional programming project
DN> today that doesn't use a debugger, if one is available. Period.
Well, I've been working on a project for about 5 years now. Imbedded
software project with from 8 to 20 professional programmers working on it over
the years. Two of the processors in each product use the Regulus (a UNIX
similar) operating system, the other four to 36 processors run MTOS (a
real-time multi-tasker). A debugger's been available for the Regulus system
since day one, but has been used by only one person, perhaps 20 times over the
whole history of the project. The MTOS machines don't have a debugger
available, but the Regulus ones do. The rest of us have still never used the
debugger. This is with the source code pushing 4 megabytes right now. The guy
that USES the debugger seems to get along with it, but to the rest of us it
was just too much trouble.
--- TBBS v2.1
* Origin: Cul-De-Sac Bar & Grill *SeaDog 4.5 & HST* 508-429-8857 (322/360)
From: Doug Asherman
To: Joubert Berger Msg #192, 07-Jan-89 10:52am
Subject: Re: declaring variables
> I have a question. Is it possible to declare a variable
> at an absolute address -- in Modula2 you can say "screen[b800h]"
> to have the variable
> screen located at b800. Can this be done in C?
Yup. I believe the syntax is:
const char far *screen = 0xb800;
The syntax for doing this is kind of confusing, and your best bet for
answering questions like this is "C: A Reference Manual" by Harbison and
Steele.
---
* Origin: Gurgi 415-845-6157, Berkeley, CA USA (Opus 1:161/41)
*** This is a reply to #153.
From: Martin Pollard
To: Gary Lau Msg #193, 07-Jan-89 02:01am
Subject: Re: Mix Power C
Gary, yours was the first message that didn't beat me about the head for my
little "commentary" at the end of my message (which, I admit, didn't belong in
this particular message and hope you didn't take the wrong way). So, yours is
1.20? Perhaps they fixed the problem with compiling in the small and large
models, then. I based my claim on two factors: (1) Compiling with the /ms and
/ml options didn't make any difference in the size of the code [although I
don't have the experience with different "models" of C programs, so I couldn't
really say if this is an indication], and (2) a review of Power C in PC
MAGAZINE's recent "C issue" stated that small/large compiling wouldn't work
with the version they tested (which just happened to be 1.16). Perhaps I
should write Mix and ask about their upgrade policy? It seems strange that
their software doesn't come with any sort of registration card (I wonder if
their older software did?). Perhaps they keep the name and address of the
person who ordered the product in a database; who knows?
Thank you very much for your reply; it helped quite a bit. (Now, to see if I
can upgrade to 1.20...)
==> Martin <==
---
* Origin: Flight of the Phoenix 300/1200/2400 MNP/5 (120/80) (Opus 1:120/80)
*** Part of a conversation.
From: Jon Guthrie
To: Braden Claxton Msg #194, 06-Jan-89 10:16am
Subject: Re: Non-ANSI C
BC> What does the acronym AWK mean? I have never seen that one before.
BC> Braden
AWK is a string processing language created by Aho, Weinberg, and
Kernighan. (HINT: Look at the authors' initials.)
--- Via OpXpress V1.06ß "Silver" SCIGUY - The Scourge of Delphi!
* Origin: FOG-LINE;FOG#51;USR HST;515-964-7937 (1:14/627)
*** Part of a conversation.
From: Jon Guthrie
To: Mike Housky Msg #195, 06-Jan-89 10:07am
Subject: Re: Ctl-C/Break
MH> > ... Anyway, how would you turn the control break off?
MH> .
MH> Well ... normally I wouldn't. I might intercept it with
MH> signal(SIGINT,xxx) if the compiler supported it (as does MSC,
MH> TC2.0, Power C, etc.) This does not prevent a "^C" from being
MH> echoed to the console by DOS, but Ctrl-Break is not likely an
MH> accidental keystroke and a well-designed program will generally
MH> honor a request to terminate gracefully.
Yes, but the working wording is 'gracefully.' If you're in the middle
of somthing that cannot be disturbed, then you need to trap it, and
handle it later.
MH> P.S. I heard some time ago about some presumably legal method for
MH> avoiding the ^C echo, using something called "raw" I/O under DOS.
MH> In the intervening two years (maybe less) I haven't had call to
MH> find out more about this (like I said, it's not often that you
MH> need to worry about that little ^C.) Maybe someone else will pipe
MH> up about it.
I know how to use raw I/O to and from the console and left the code here
some time back. It was in response to a different problem, so I don't
know if it doesn't echo the '^C' but it definitely works. (As long as
you don't mind avoiding "getc()'s" and such...Turbo C's library hangs
the machine when you try to use anything but fread() during raw input.)
Could post the code to get in and out of raw mode again, I guess.
--- Via OpXpress V1.06ß "Silver" SCIGUY - The Scourge of Delphi!
* Origin: FOG-LINE;FOG#51;USR HST;515-964-7937 (1:14/627)
*** Part of a conversation.
From: Jon Guthrie
To: Roy Browning Msg #196, 06-Jan-89 10:14am
Subject: Re: Non-ANSI C
RB> As a K&R 'C'eer I can tell that that won't fly. The ANSI
RB> compilers can handle the old method of function declaration but
RB> the K&R compilers can't handle the prototypes!!! Every
RB> functions will have to be hand modified or or both versions
RB> incorporated with #defines. Example:
RB> #ifdef ANSI
RB> int doit(int cnt, char *str){}
RB> #else
RB> /* K&R */
RB> int doit(cnt, *str)
RB> int cnt;
RB> char *str;
RB> {}
RB> #endif
Actually that should be
#ifdef ANSI
int doit(int cnt, char *str); /* NOTE the semicolon. That's what */
/* makes it a prototype */
#else
int doit(); /* just the return type is specified */
#endif
Then, later on, you would have the actual function defintions. These
are just function declarations.
--- Via OpXpress V1.06ß "Silver" SCIGUY - The Scourge of Delphi!
* Origin: FOG-LINE;FOG#51;USR HST;515-964-7937 (1:14/627)
*** This is a reply to #194.
From: Jon Guthrie
To: Henry Piper Msg #197, 06-Jan-89 10:17am
Subject: Re: Pascal to C
HP> You do have it right! The advantage of .COM programs are that they
HP> are faster to load than .EXE, but are limited to
HP> 64k.(Supposedly). .EXE programs can be much larger, but are
HP> somewhat slower to load.
Another advantage (or disadvantage, depending on the situation) is that
.COM files have access to ALL of memory, while .EXE files are only
allocated what they said they needed.
--- Via OpXpress V1.06ß "Silver" SCIGUY - The Scourge of Delphi!
* Origin: FOG-LINE;FOG#51;USR HST;515-964-7937 (1:14/627)
*** Part of a conversation.
From: Martin Maney
To: Randall Greylock Msg #198, 06-Jan-89 03:42pm
Subject: Re: COMPUTING ADDRESS OFFSETS WITHIN
RG> What I want to do is something like thives to the advertising industry!
bject: Re:> [computed offset to C in _MyStruct goes here]
RG> };
RG>
RG> I.E., I want to do it STATICALLY! At COMPILE TIME. Not run time.
_MyOffset = {
"Variable C",
offsetof(_MyStruct, C)
};
Should do the trick. Of course, you're limited (almost certainly) to offsets
into structures defined "above" the place the initializer is, but that's not a
problem.
/\/\artin
--- msged 1.94S ZTC
* Origin: Mind is Moving [Palatine, IL] (1:115/790.3)
*** Part of a conversation.
From: Alex Wyss
To: Adam Beauregard Msg #199, 04-Jan-89 08:44pm
Subject: Stop: HAYES OR HAYES COMPATIBLE MODEMS
A: Does anyone out there have a 1200 or higher baud modem they want to
A: sell. It must be an external, and have a decent price on it. It will be
A: greatly appreciated if you have one to sell. Thank-you.
To ALL,
Please, please stop non-topic messages, this area is already flooded by
correct messages! There is a fast growing sysop group in this region who wants
to drop this huge conference! I certainly have a lot of modems to sell, but I
definitively do not believe it to be useful, to send it over the sea, do you?
CU, Alex
--- msged 1.943S ZTC
* Origin: OS-9/68K Gepard Box Zuerich <EFFO/IVSS/sf..> (fidonet 2:302/801)
From: Gottfried Ganssauge
To: Paul Edwards Msg #200, 05-Jan-89 03:18pm
Subject: Blue murder
Hi paul,
thanks for the welcome.
> I think maybe you read the wrong bit of documentation?
> I think a lot of people in this echo would have been screaming blue murder
> if Borland stuffed that up.
They definitely did it :>( (TURBO C Reference Guide, 1st edition, page 122),
but I didn't hear anything like "blue murder" <grin>
> Maybe they mistranslated when converting the manuals to Swedish or
> whatever?
German :-), but I read the english version.
> It's good to see some Zone 2 messages coming in.
> It's a shame your origin line doesn't say what country it's coming from.
Hope this is corrected by now
Ciao, Gottfried
--- ConfMail V4.00
* Origin: Gotti's AT (Berlin/W-Germany) (2:245/1000.35)
From: Ron Dwight
To: Martin Pollard Msg #201, 05-Jan-89 09:00am
Subject: Re: Mix Power C
> 1) My version of th1/1004 (Opus 1:26102/4)
From:
---
* Origin: III Corps atest version of the compiler is 1.2, but IF you upgrade and
you use Power C trace, be sure to upgrade that as well. The compiler emits 32
character variables for trace and the old trace only handles 8. This is not
too bad but you will have to give the option "/t8" every time you compile for
trace.
> 2) Has anyone been able to compile using the small and
> large memory
Never tried.
> 3) How do you feel about Power C? Likes? Dislikes?
FANTASTIC value for money, good tutorial. Trace is wonderful, easy
to use. Problems are compatibility, but they are working on it.
I agree with your comments and it is really VERY sad to see the
condition into which we (the consumers) have been placed. We are told, and
believe, that if it's cheap it cannot be any good. Think about that for a few
moments. Is it REALLY true that cheap=NBG? Do you REALLY believe cheap=NBG?
If so WHY? Let's try not to be slaves to the advertising industry!
bject: Re: VAXen
-> Actually, you can stop calling VAXen (the plural form of
-> VAX) super-minis after the VAX 11/780. Anything more
-> powerful than that COULD be considered to be a mainframe...
-> VAX 8800 is a BIG machine.
I guess you have your point there. I wonder what the definition of
mainframe is.
--- QuickBBS v2.03
* Origin: The Isle Of Lucy (1:106/797)
*** This is a reply to #66.
From: Patrick Wu
To: Mike Housky Msg #207, 07-Jan-88 09:36am
Subject: Re: Ctl-C/Break
-> Well ... normally I wouldn't. I might intercept it with
-> signal(SIGINT,xxx) if the compiler supported it (as does
-> MSC, TC2.0, Power C, etc.) This does not prevent a "^C"
Thanks for the information, I may give it a try later.
--- QuickBBS v2.03
* Origin: The Isle Of Lucy (1:106/797)
*** Part of a conversation.
From: Patrick Wu
To: Larry Marshall Msg #208, 07-Jan-88 09:40am
Subject: Re: DEBUGGER.
-> . Boy, if you talk to your "straight forward" computer the
-> talk here I wonder what results you get. I thought
-> known for their concern for syntax and proper language use,
-> what the language. I just applied for a job at the
-> University of
-> Houston; does everybody write like that? I wouldn't have
This is a sign of your ignorance, and I will bet you one hundred dollar if
you can write Japanese or Chinese as good as my English. I would be
surprised if the University of Houston hires you, then again, they would
hire
anybody.
--- QuickBBS v2.03
* Origin: The Isle Of Lucy (1:106/797)
*** This is a reply to #186.
From: Roland Brown
To: Kevin Wang Msg #209, 07-Jan-89 10:48am
Subject: Re: re: Turbo vs. 2.0
>
> Let me ask this further question: Do you remember absolutely
> all the commands, and never have to look them up in the
> reference book? Well, Quick C has a neat function in it...put
> your cursor over a particular function, press Shift-F1,
> and you will get a syntax/usage of that particular function.
So does Turbo C (Crtl F1) and if you have the TASM module you get a stand
alone TSR called THELP that you can use with Turbo C or Pascal or, I believe,
roll your own helps for whatever.
roland
---
* Origin: Sky Pilot Point Mail Box Off 261/1004 (Opus 1:26102/4)
From:
---
* Origin: III Corps Bulletin Board System - Garrison Version (Opus 1:382/63)
From: Zero Eagle
To: Mike Housky Msg #212, 06-Jan-89 11:52am
Subject: Re: Ctl-C/Break
" P.S. I heard some time ago about some presumably legal method for
" avoiding the ^C echo, using something called "raw" I/O under DOS.
" In the intervening two years (maybe less) I haven't had call to
" find out more about this (like I said, it's not often that you
" need to worry about that
" little ^C.) Maybe someone else will pipe up about it.
I'd be genuinely interested in that. But here's a question for you;
What exactly causes the "^C"? It it displayed through the keyboard
harware@5╣╤ò╔╔╒┴╤²jñh┤╡
ñCà--- Ned 1.01
--- ConfMail V4.00
* Origin: _*~ The Fowl Weather Post ~*_ &Fowl_Weather_Post=148314; /* Opus
*/ (1:148/314)
*** This is a reply to #210.
From: George Stanislav
To: Jon Guthrie Msg #213, 06-Jan-89 03:28pm
Subject: Re: Learning C
> GS> A problem located deep in the library can be discovered
....
>
> Two things. One, how come everybody but me finds errors
> deep in the
> standard library?
I did not say it was the STANDARD library, Jon. However, it was in the library
specifically written for the project. There was a minor typo in it which
happened to paralyze the whole system.
> I did not say that I would NEVER use the debugger. Fact
> is, I already
> HAVE. I AM saying that I do not expect to need it much.
I did not say that you said anything. I simply stated that a debugger can be
an invaluable tool. I was reacting to the statement (whether yours or someone
else's, I do not remember) that debuggers are used by lazy people.
Debuggers are extremely important. It is sometimes impossible to see your own
logical mistake unless you go through the program step by step. Or at least
through the section of the program where the problem occurs.
-George-
--- Opus-CBCS 1.10.v.x
* Origin: Astral Board * OPUS Rising * (1:129/39.1)
*** Part of a conversation.
From: Michael Schwartz
To: Roy Tellason Msg #214, 06-Jan-89 04:58pm
Subject: Programming in C
Hi Roy,
Thanks for responding to my message. I'm glad your fond of "Programming Using
the C Language." I will check out "Software Tools" and "Reliable Data
Structures in C", and "Variations in C" as well.
--- Opus-CBCS 1.10.v.x
* Origin: Astral Board * OPUS Rising * (1:129/39.0)
*** There is a reply. See #249.
From: Andy Wendel
To: Kevin Wang Msg #215, 07-Jan-89 03:01am
Subject: re: Turbo vs. 2.0
Same nifty help is in TC2.0 as well. Although I am now seriously thinking
about Zortech X C++ (Micro C says too many good things about it to let it slip
by, and it is cheaper than the $105 base for TC2, which I already have).
Andy
--- msged 1.943S ZTC
* Origin: Guild House AT - 16Mhz Power (bleah 1:109/741)
*** This is a reply to #147.
From: Randall Greylock
To: Bob Stout Msg #216, 06-Jan-89 12:03pm
Subject: Re: Walter and Micro C
So by putting nearly everything in it's own .obj, I'm really screwing things
up if I understand what you are saying ...
--- ConfMail V4.00
* Origin: Greylock (1:321/202.4)
*** Part of a conversation.
From: Daniel Lyke
To: Ron Dexter Msg #217, 05-Jan-89 09:02am
Subject: Re: Pascal to C
> Why??
> Why did Borland go to EXE files, are they really any
> better?
> Tell me if I'm right; EXE files are prefered because
> you can
> continue to add or link to them???; and COM files are
> good because
> they "can be" small and faster???
This isn't really C, but it could be useful to many of us.
Under MS/PC-DOS, the .COM files are those that are direct memory images. The
.EXE files have some relocation and quasi-compression (unassigned variables
aren't part of the memory image), and are easier to make work across multiple
code and data segments.
To handle segments larger than 64k, a .COM file would have to do relative
manipulation of the segment
To: Charlie explicitly ode segment, although calls could probably be done with PUSHes and RETs.
A .EXE file puts the appropriate labels and loader information in, and when
the loader finds a lo40;36mTo: All happen. Can any of you help me? ate to the current load position.
Under OS/2 and Windows you can add or link dynamically, including the
appropriate code for the situation or sharing code between applications, but
MS-DOS was written when memory was expensive and IBM didn't know systems
design.
Memory's cheap, but IBM hasn't changed.
Dan
eading in characters,
the array is filled tong characters,
but ms which
use similar nomenclature, such as VMS)
--- Sirius 0.50
--- BINKscan v0.4
* Origin: POINTless Wondering (Opus 1:362/101.2)
*** This is a reply to #197.
From: Daniel Lyke
To: Paul Edwards Msg #218, 05-Jan-89 09:23am
Subject: Re: sin() in calculator
> 1) Is it ok to call a function with 2 parameters, when
> it only expects
> to receive 1?
Yes. But you may not receive the answer that you expect.
As for the rest of the question, I'm not sure that I totally understand it,
but I'd probably build an array of structures, like you suggest, and include a
little more information, such as what and how many the parameters are supposed
to be. Then, when you hit the function, you could evaluate 'til you hit a
comma or a closing paren. Check for the appropriate errors (mismatched
parens), and this'll tell you whether you have the appropriate number of
arguments.
I suggest that you build your evaluate() function so that it can be called
recursively. Expression evaluation is a little easier with recursion.
Any help, or am I totally of the mark?
Dan
--- Sirius 0.50
--- BINKscan v0.4
* Origin: POINTless Wondering (Opus 1:362/101.2)
*** Part of a conversation.
From: Jerry Pevahouse
To: Theeast Isred Msg #219, 05-Jan-89 08:23pm
Subject: Re: Learning C
ALL real C compilers are case sensitive. That should always be
considered when choosing varibles. Whether the linker is case
sensitive or not I would advise avoiding similar names for varibles
and using global varibles very sparsely. Ideally in C varibles
should be local and passed as parameters to avoid conflicts. Thats
one of the reasons Kernigan and Richie chose the function/block code
approach and C is such a stack intensive language. Ideally there
could be 50 variables named "myvar" declared locally, as long as
there isn't a global "myvar" varible or more than one local "myvar".
--- EMM 2.00r Support SHAREWARE register your programs!
* Origin: The Switch Room Plainsboro NJ 799-9374 (9:807/11)
*** Part of a conversation.
From: Jerry Pevahouse
To: Bill Leary Msg #220, 05-Jan-89 08:41pm
Subject: Re: READING THE 'COMMAND LINE'
main(argc,argv)
int argc;
char *argv[];
this always works on my compiler and is more Kernigan/Richie I
believe.
The typing/declaration within the brackets is more Turbo C-like to me
and I think is more compiler specific.
--- EMM 2.00r Support SHAREWARE register your programs!
* Origin: The Switch Room Plainsboro NJ 799-9374 (9:807/11)
*** This is a reply to #183.
From: Jerry Pevahouse
To: Charlie explicitly relied on it being 0 a few times.
---
* Origin: BIKENET, Missoula MT (406) 549-1318 (Opus 1:346/5)
From: Dick Copits
To: All happen. Can any of you help me? What I tried was:
name[26];
x=0;
while(x<25 && char[x]!='\n')
{
name[x]=getchar();
x++
}
and I even tried a display from within the loop and before the x++ is done.
What seems to happen is that the display that I put in the loop is never done
until the loop is exited. If I press enter while I'm reading in characters,
the array is filled tong characters,
but if I press enter, there are only enough characters to fill the array. Can
anyone give me the correct and TESTED code to accept characters into the
variable "name" and terminate either on the pressing of the enter key or the
entering of the 26 characters? Thank you very much.
Dick Copits, Sysop, 322/591, 508-366-5685.
--- ConfMail V4.00
* Origin: (c)1988 Rogers & Blake (508)373-2204 (1:324/120)
From: Bill Leary
To: Larry Marshall Msg #226, 07-Jan-89 09:38pm
Subject: Re: SUBST, ADS
I think that the companys never sending me anything at all (except MicroPro,
bless there hard-up-for-money hearts) bothers me most because the things I
really want to hear about are "for a limited time only, upgrade to rev 8.9.1
for just $90.00, after such-and-such a date, $500.00!". I missed the
window-of-opportunity on my C compiler (Manx Aztec), Turbo Pascal (twice!),
PC-Paintbrush, and Microsoft Windows. Although the last DID allow me to
upgrade, when I pointed out that they'd never told me anything, even though I
was registered.
--- TBBS v2.1
* Origin: Cul-De-Sac Bar & Grill *SeaDog 4.5 & HST* 508-429-8857 (322/360)
*** This is a reply to #122.
From: Bill Leary
To: Bob Stout Msg #227, 07-Jan-89 09:44pm
Subject: Re: PRODUCTIVITY
While I DO in fact compile smaller programs to .COM insted of .EXE (my
compiler's loader has an option), the only noticible difference I usually get
is about a half K smaller. Since I'm using a reasonably fast disk, on a 10MHz
AT clone, the load time differences aren't noticible. The half K smaller is,
of course, the .EXE program prefix block (I forget what it's REALLY called).
At my usual 2400K baud a halfK, amounts to about 2 seconds.
--- TBBS v2.1
* Origin: Cul-De-Sac Bar & Grill *SeaDog 4.5 & HST* 508-429-8857 (322/360)
*** This is a reply to #185.
From: Bill Leary
To: Rubens Abboud Msg #228, 07-Jan-89 09:50pm
Subject: Re: TC2.0 - FEOF() BU
I know what you mean. I use the phrase "Please do babble on" with people at
work once in a while, but in that case my facial expressions, and the fact
that they know me, makes a world of difference.
Anyhow, I've wasted enough space on this conference on this subject and, as
you say, it was settled via netmail anyhow.
--- TBBS v2.1
* Origin: Cul-De-Sac Bar & Grill *SeaDog 4.5 & HST* 508-429-8857 (322/360)
*** This is a reply to #108.
From: Casey Mccabe
To: All Msg #229, 08-Jan-89 01:32am
Subject: Power C
Hello, everybody. I am inquiring about Power C.
- What type(s) of advantages, disadvantages does it
have over other C compilers?
- What are some speed benchmarks for it in comparison to
other C compilers(compiling, linking, compiled program
execution speed(S), standardized benchmarks, etc.)
- What are the disadvanyages of it being an ANSI-Compiler
only?
- Is it sufficient to operate in a multi-function enviorment
(Multi-User BBSs compiled in it-would they work well?)
If not what compilers would?
- How efficient is it compared to other compilers?
- Is it well equiped for 'heavy duty programming'?
What compilers do you suggest - what would be considered much better?
I would be very appreciative of any responses. Thank you very much.
Aufwiedersehn!
---
* Origin: Dave's OPUS!/BINK *SDS*SDN*HST* Lowell MA (Opus 1:324/275)
From: Mike Hamilton
To: All Msg #230, 07-Jan-88 09:45am
Subject: Common Data??
I'm comiling a fairly large program in MSC/QuickC. Either one I use, I
always get an error that I have run out of Common Data Memory, or something
to effect...? What does this mean, and how can I prevent it? I have split
the program into modules. No good. I have one structure array of 500,
which I think may be causing the problem. What can I do?
--- QuickBBS v2.03
* Origin: The Mystic Tribunal, N. Andover, Ma. (508)689-4493 (1:324/131)
From: Ted Shapin
To: All Msg #231, 05-Jan-89 12:22pm
Subject: Want to count non-comment source lines
I need to count non-comment source lines in C pgms.
Do I have to parse the whole C pgm or is there an easier
way?
Ted
--- Opus-CBCS 1.10.v
* Origin: Mike's C Board, WOCing the C shore 619-722-8724 (1:202/201.0)
From: Jeffrey Nonken
To: George Stanislav Msg #232, 07-Jan-89 09:29am
Subject: Re: Learning C
> > I had never used a debugger before TC 2.0, and I don't
> > expect to use
> > that one very much. I agree with many of your points
> If I did not use a debugger, I would not have the tear line
> I do now
> - I would still be wondering why I cannot get Opus 1.10
> rolling.
>
> A problem located deep in the library can be discovered
> only using a debugger to go through the program byte by
> byte.
>
Agreed 100%! I have three main debug techniques, and I mix-and-match
'em all the time.
- Stare at the code
- Make deductions from the results
- Use a debugger (or ICE)
The thing I like about Codeview-type debuggers is that I can do all three at
once onscreen!
--- Opus-CBCS 1.03b <> NoOrigin 3.3
--- ConfMail V4.00
* Origin: On a clear day you can C forever (1:103/522)
*** Part of a conversation.
From: Jeffrey Nonken
To: Mok Msg #233, 07-Jan-89 09:49am
Subject: Re: HELLO.
> MOK!
> The Magic Man
"My name is Mok, and thanks alot!"
...but Mok is a bad guy. Any reason you chose him?
--- Opus-CBCS 1.03b <> NoOrigin 3.3
--- ConfMail V4.00
* Origin: On a clear day you can C forever (1:103/522)
*** This is a reply to #187.
From: Jeffrey Nonken
To: Randall Greylock Msg #234, 07-Jan-89 09:56am
Subject: Re: ZOO listing
> ER> Does your source have configuration for Amiga? If
> so, I would like to
> ER> be able t freq it!
>
> The sources I have (Z201Src*.Zoo) talks about Amigas.
>
Mine does too, but not where to get it (unless it's by contacting the author).
I'd be interested in an Amoeba version myself.
--- Opus-CBCS 1.03b <> NoOrigin 3.3
--- ConfMail V4.00
* Origin: On a clear day you can C forever (1:103/522)
*** This is a reply to #47.
From: jim nutt
To: Mike Housky Msg #235, 05-Jan-89 10:54am
Subject: Re: TC 2.0 woes
In a message of <03 Jan 89 23:59:32>, Mike Housky (1:103/522.6) writes:
>[You speaking to me:]
>you> integrated mode nothing... quick c needs it in any enviroment
>you> and turbo c is very nearly as memory hungry...
>.
>Interesting. Are you saying that QCL needs even nearly as much memory as
>QC? Or that TCL needs nearly as much memory as TC? I haven't pushed either
>of these to the limit. (Mainly I use MSC's CL which "gracefully degrades"
>in limited RAM by displaying a warning and limiting or turning off
>optimizations.) Still, I would be sincerely amazed if either T or Q
>requires nearly as much in the command line mode as in the interactive
>mode.
quick c needs MORE memory to operate from the command line (at least in my
experience). it won't even load in 256k. turbo c isn't quite as bad, the
integrated enviroment is a separate program from the command line compiler.
but it's still a memory hog.
jim nutt
'the computer handyman'
--- msged 1.962S ZTC
* Origin: numerology: recreational computer science (1:114/15.11)
*** This is a reply to #222.
From: Grant Wagner
To: Scott Ladd Msg #236, 05-Jan-89 04:39pm
Subject: Re: QuickC 2.00
> I have talked with Greg Lobdell, the person who oversees
> all of the 'Quick' languages at Microsoft. He confirms
> my interpretation: you own your source and the resulting
> .EXE file. All Microsoft owns is the copyright to the library
> routines, for which it charges nothing. Microsoft's license
> is worded such that people become confused by it; the only
> time you have to give Microsoft any direct credit is when
> your use one of their run-time .EXEs, such as BRUN45.EXE
> for QuickBASIC, or MSHERC.COM for Hercules compatibility.
Thank you for the clear, concise and accurate information regarding
this subject (accurate because it comes from someone at Microsoft). I
appreciate you taking the time to ask about this, it clears up a misconception
I and others I have talked to seem to have regarding programs compiled using
Microsoft products.
...Grant
---
* Origin: Negative Zone * 306-565-8538 (Opus 1:140/34)
*** This is a reply to #121.
From: Ray Gardner
To: Randall Greylock Msg #237, 06-Jan-89 02:08pm
Subject: Re: structure member offsets
> JK> You don't need the tMS variable, since you can just do:
> JK>
> JK> C_offset = (size_t) &(((_MyStruct *)0)->C)
>
> Earth to moonbase everyone! I DON'T WANT TO DO THIS AT RUN TIME!
>
> Let me restate the problem.
>
> Assume TWO structures - _MyStruct as defined above, and:
>
> typedef struct {
> char FldNm[30];
> unsigned int Offset;
> } _MyOffset;
>
> What I want to do is something like this:
>
> _MyOffset = { /***** error: note missing structure name! -- rdg */
> "Variable C",
> [computed offset to C in _MyStruct goes here]
> };
>
> I.E., I want to do it STATICALLY! At COMPILE TIME. Not run time.
Randall, ANSI C has a macro offsetof(structure_type, member_name) for this
purpose. Zortech C doesn't come with one (yet), but the following version
suggested in the ANSI C Rationale seems to work fine, at compile time.
#define offsetof(type, member) ((unsigned int)(char *)&(((type *)0)->member))
(The Rationale used size_t instead of unsigned int. They also note that this
definition may not be portable to all implementations.)
(Note similarity to what John Kruper recommended.)
Then just put offsetof(_MyStruct, C) in your structure initializer. This
worked in ZTC and will (I'm guessing) probably work in MSC or TC too.
--- msged 1.93L ZTC
* Origin: Ray Gardner (1:104/45.3)
From: William Herrera
To: Randall Greylock Msg #238, 06-Jan-88 07:51pm
Subject: Re: COMPUTING ADDRESS OFFSETS WITHIN
>Let me restate the problem.
>Assume TWO structures - _MyStruct as defined above, and:
>typedef struct {
> char FldNm[30];
> unsigned int Offset;
> } _MyOffset;
>What I want to do is something like this:
>_MyOffset = {
> "Variable C",
> [computed offset to C in _MyStruct goes here]
> };
compilerdependent()
{
typedef struct
{
int A;
int B;
int C;
} _MyStruct;
typedef struct
{
char FldNm[30];
unsigned int Offset;
} _MyOffset;
static _MyOffset int_C_offset =
{
"Variable C",
sizeof(_MyStruct) - sizeof(int)
/* ! Danger--Does/can my compiler pack structures? */
/* If not, I'm out of luck */
};
}
(...actually this is easier to do in c++)
--- QuickBBS v2.03
* Origin: C'ing Clearly Into the Wind (303)939-9272 * FidoNet (1:104/63)
*** Part of a conversation.
From: John Kruper
To: Paul Edwards Msg #239, 07-Jan-89 02:04am
Subject: sin() in calculator
> A bloke I know has written a calculator in C. Now he wants to add support
> for sin, cos, tan, log and any other function that anyone might write at
> a later date, such as cfact (for factorials). Now the functions may take
> any number of parameters, and return int, float, double etc. When
> someone types in sin(3) it is fairly obvious what they want. But how do
> you convert this line into a function call to the same name?
I would use different structures for the different function types. This isn't
as bad as it may sound, since there are probably only a few different argument
types needed for the calculator. Like: takes two double arguments and returns
double. Or: takes one double argument and returns double. Also, you could do
all of your arithmetic in double precision, and ignore floats and ints. Though
floating point is slower than integer arithmetic, in a calculator the
calculating speed probably doesn't matter that much. And any function which
will only work on integers can convert its double arguments to ints, crunch on
them, then convert the result back to doubles (which may lead to round off
problems, but oh well...). You can put a "wrapper" function around any library
function you want to call which expects an int argument.
Here's what a table might look like:
typedef struct {
char *name;
double (*func)(double);
} FUNC_1ARG;
FUNC_1ARG func1[] = {"cos", cos, "sin", sin, "tan", tan};
#define CNT_1ARG (sizeof(func1[])/sizeof(FUNC_1ARG))
And so on for FUNC_2ARGS, FUNC_3ARGS, etc. When presented with a function name
("sin" for instance), you could search each of the tables until you find it
(in func1[]), then you could verify that the user gave it the right number of
arguments (1 in this case). Or you could first parse the number of arguments
that the user gave and then check that table for the function name they used.
(Though from an error message point of view, you probably want to discriminate
between calling a valid function with the wrong number of arguments, and
calling a non-existent function. Which means you have to search all of the
tables anyway to see if the function exists with a different number of
arguments than the user gave).
Another approach would be to look up the function name in a table which gives
the argument list type for each function name.
/* possible argument and return types */
enum arg_types {DBL, STRNG, DBL_DBL, DBL_DBL_DBL, DBL_STRNG, STRNG_STRNG};
enum ret_types {DBL, STRNG}
struct {
char *name;
enum arg_types arg; /* argument list type */
enum ret_types ret; /* return type */
} functions[] = { "min", DBL_DBL, DBL, "sin", DBL, DBL, "strcat", STRNG_STRNG,
STRNG, "strlen", STRNG, DBL};
If the function names are kept in alphabetical order, than a bsearch() would
be a good way to search the table for a match.
After the function name is found in the table, we know what its argument list
type is, so we can check that the user gave the right number and type of
arguments. Also, we know how to call the function, and what it returns.
> 1) Is it ok to call a function with 2 parameters, when it only expects
> to receive 1?
Ummm... It will usually work, since the caller is in charge of dealing with
the stack. But it isn't guaranteed to work.
> 2) Is it possible to build a parameter list?
A C function which expects to be called with three parameters should be called
with those three parameters:
(*fun)(a, b, c);
There is no easy way around this in C. If you have control over the functions,
you took change their definitions so that every function takes one argument,
which is a pointer to a parameter list:
(*fun)(ptr_to_parameter_list);
For instance, if your C library has vprintf(), it is basically another
interface to the printf() family which uses an argument which is a pointer to
a variable length parameter list, instead of the ususal printf() variable
variable length argument list.
Also, if you feel handy in assembler, you can write a function which takes an
argument byte count, a pointer to a C function, and a pointer to an argument
list, and calls the C function with the expected number of arguments. However,
you have to do this in assembler; it won't work in C.
--- msged 1.87S ZTC
* Origin: A point in space (off of P.I.E.) ( 1:343/27.3)
*** This is a reply to #218.
From: John Kruper
To: Randall Greylock Msg #240, 07-Jan-89 02:04am
Subject: Computing address offsets within a structure ...
>>> I have another structure that would like to know the offset of
>>> I'd like this second structure to know this a) without me figuring it
>>> by hand, and b) without having an actual variable statically allocated.
>> The classic trick is get devious about casts and use:
>>
>> #define OffsetOf(name, member) (size_t) &(((name *)0)->member)
>>
>> This isn't guaranteed to be portable, but it (or some variation
>> thereof) "usually" works.
>>
>> ANSI C includes a function/macro called offsetof() in stddef.h for just
>> this purpose. My OffsetOf() macro above is one of the implementations
>> that the Rationale suggests as possible for the ANSI offsetof().
> Yes, but can these be used while statically initing ANOTHER structure?
> I.E., no ='s?
I have no idea what you mean by "statically initing" another structure, since
the only form of initialization that I am aware of involves an '='. If you
mean:
struct name {
int member1;
char *member2;
};
struct name2 {
int offset;
int other_stuff;
} foo = { (int) &(((struct name *)0)->member2), 0);
My reading of the ANSI draft (section 3.4 Constant Expressions) says that yes,
the above method should work. (If that is what you mean by "statically
initing" without an "="). However, from a practical point of view, you are in
a not currently well standardized part of the C language, so (1) try it and
see if it works on the compilers of interest, and (2) be aware that is
probably somewhat non-portable currently (though as far as I can tell it is ok
according to ANSI).
--- msged 1.87S ZTC
* Origin: A point in space (off of P.I.E.) ( 1:343/27.3)
*** This is a reply to #38.
From: John Kruper To: Randall Greylock Msg #241, 07-Jan-89 02:23am
Subject: Re: COMPUTING ADDRESS OFFSETS WITHIN
RG = Randall Greylock
??? = someone else who responded to RG's initial question
[the initial question from RG]
RG> typedef struct {
RG> int A;
RG> int B;
RG> int C;
RG> } _MyStruct;
[a suggested solution, which unfortunately doesn't solve the problem, since]
[it computes at run-time, not compile-time]
??> int C_offset;
??> _MyStruct *tMS = (_MyStruct *)0;
??> C_offset = (int)( (long)( &tMS->C ) - (long)( tMS ) );
[a comment to ?? from me pointing out a way to simplify the above]
JK> You don't need the tMS variable, since you can just do:
JK>
JK> C_offset = (size_t) &(((_MyStruct *)0)->C)
RG> Earth to moonbase everyone! I DON'T WANT TO DO THIS AT RUN TIME!
Although your quoting destroyed who said what to whom, I'm pretty sure the
above "re-enactment" is correct. In other words, (key point here) I said my
"C_offset = " comment in response to someone else's "C_offset = " approach. I
was pointing out a way to simplify the expression they offered. I *didn't*
worry about keeping to the terms of your original request (compute at compile
time, not run time) because I had earlier written a reply to your original
question, containing an approach which should work at compile time. And
judging from the time of your replies, you saw my message containing a compile
time approach a full day before you saw my comment above (which in any case
was commenting on someone elses approach, and wasn't addressed to you).
Anyway, its pretty easy to see how to get from my suggestion above to a
compile time initialization of a structure member. You just move everything
that is to the right of the '=' sign (in the assignment to C_offset) to the
appropriate place inside the structure initialiazation. After all, in both
cases they are just assignments - the expression will look the same in both
cases. The only issue is whether the compiler thinks the expression is a
constant which can be computed at compile time. According to my reading of
ANSI, it should work. (Also, the other person's suggested approach assumed at
least one instance of the structure - tMS - had been declared. Not an onerous
restriction, but still a restriction of that approach, which I removed with my
suggested change).
Otoh, in my reply to you (which I know you've read, since you replied to it a
full day before your "earth to moonbase" comment above), since you asked for
an approach which could work in a structure initialization (at compile time),
my suggestion took the form of a macro which could do just that.
So, I am definitely not thrilled to get a message written to me (quoting
things I said to someone else in a different context) which says:
> Earth to moonbase everyone! I DON'T WANT TO DO THIS AT RUN TIME!
Answering in the same vein: BUT MY REPLY TO YOU SUGGESTED A COMPILE TIME
METHOD. WHY HAVEN'T YOU TRIED IT?
(Actually, since in these pre-ANSI days this is a grey area in C, it is
possible your compiler will gag and won't accept this at compile time. But in
any case there is only one way to find out: try it!)
RG> What I want to do is something like this:
RG>
RG> _MyOffset = {
RG> "Variable C",
RG> [computed offset to C in _MyStruct goes here]
RG> };
RG>
RG> I.E., I want to do it STATICALLY! At COMPILE TIME. Not run time.
Well, did you try what I suggested in my message to you????
#define OffsetOf(name, member) (&(((name *)0)->member))
Use the OffsetOf macro in the structure initialization just the way you would
expect:
struct {
char *name;
int offset;
} _MyOffset = {"Variable C", OffsetOf(_MyStruct, C)};
Of course, its quite possible that you didn't understand my original reply
(either because I explained it in a lousy way, or because you don't understand
this aspect of C). In which case, a request for clarification might have been
more appropriate than your "earth to ..." comment.
--- msged 1.87S ZTC
* Origin: A point in space (off of P.I.E.) ( 1:343/27.3)
*** This is a reply to #238.
From: John Kruper
To: Bob Stout Msg #242, 07-Jan-89 02:35am
Subject: Re: Walter and Micro C
This is only vaguely relevant to what you've been talking about (writing C
program so the compiler can generate more efficient code), but here goes
anyway <grin>.
Have you ever read Jon Bentley's "Writing Efficient Programs" or "Programming
Pearls"? I just finished working through them and found them quite valuable.
Though many of the examples are in C, mostly he is talking about more general
things to speed up programs. Both at high levels (choosing the right
algorithm, choosing the right data structure), and at low levels (writing a
loop in the most efficient manner). The problems at the end of the chapters
are just full of really neat, tricky, difficult, useful programming puzzles.
(Which is why I said I "worked" through the book, as opposed to simply reading
it).
Examples of what I mean by puzzles: (1) Given a an array of N integers (i.e.
unordered positive and negative numbers), find the contiguous subarray with
the maximum sum. (As a special case, if all of the numbers in the array are
negative, report that no subarray qualifies). For instance, with an input
array of:
31 -41 59 26 -53 58 97 -93 -23 84
the algorithm would report that the contiguous subarray with the maximum sum
has a sum of 187 and extends from the 59 to the 97. There is a clever way to
do it this in only one pass over the array.
(2) Counting bits. Count the number of bits that are on in a 32 bit word.
Assume that speed is critical, and that you can use as much data space as
necessary. Then assume the reverse is true. Then assume some reasonable
compromise between the two.
A lot of the stuff he talks about is similar to the stuff you find in Knuth's
work. He has another book called "More Programming Pearls", but it isn't as
useful from an efficiency point of view. His later columns in the ACM are
mostly about things I don't find as relevant, like the glories of languages
like awk, and things like that.
--- msged 1.87S ZTC
* Origin: A point in space (off of P.I.E.) ( 1:343/27.3)
*** Part of a conversation.
From: Bob Roden @ 914/201
To: All Msg #243, 06-Jan-89 09:31pm
Subject: Turbo C 2.0 Problem
I just made the overdue jump from QuickC to TurboC 2.0, and am
not yet very familiar with the new environment. I have a
problem trying to use third party code. Specifically, I bought
a package called "C Database Toolbox," and I want to try using
some of the routines. I installed them in their own
subdirectory under my "TC" subdirectory. So far, so good.
I added the subdirectory -- "c:\tc\dbtools" -- on the "include
directories" and "library directories" lists under the Options
menu in the Turbo C 2.0 environment. I included in my working
file the appropriate header file (isam.h) that the database
functions call for. But after doing all of this, I can't get
anything to link. I get messages saying that the function names
I'm attempting to used are "undefined symbols." And in the
message stating the error, a leading "_" is attached to the
names it thinks are undefined (e.g., "icreatedb" is listed as
"_icreatedb".
So I'd appreciate any help on this problem, from either of two
angles: (1) What is going on here? or (2) More generally, how do
you use third party routines from within the Turbo C 2.0
environment?
As a final note I add that the manuals were no help at all on
this one.
--- RBBSMAIL 17.1A
# Origin: SF PCUG BBS (415)621-2609-HST-(FIDO 1:125/41) (RBBS-PC 8:914/201)
* Origin: Network Gateway to RBBS-NET (RBBS-PC 1:103/710)
From: John Kruper
To: Randall Greylock Msg #244, 07-Jan-89 02:56am
Subject: Offsets of members within structures (working example)
Since there seems to be some confusion as to how my OffsetOf() macro can be
used to initialize a structure member at compile time, I decided the best
explanation was a working test program. The following compiles with no
Kd±rnings or errors under Microsoft C5.1 at warning level 3, and runs
correctly.
#include <stdio.h>
#define OffsetOf(name, member) ((int)(&(((struct name *)0)->member)))
struct foo {
int member1;
char *member2;
};
struct foo2 {
int offset; /* the offset of the member within the structure */
int member2; /* dummy - we'll just always set it to zero */
} goo[] = { OffsetOf(foo, member1), 0, OffsetOf(foo, member2), 0};
int main(void);
int main()
{
printf("offset of member 1 in the foo structure: %d\n", goo[0].offset);
printf("offset of member 2 in the foo structure: %d\n", goo[1].offset);
return 0;
}
--- msged 1.87S ZTC
* Origin: A point in space (off of P.I.E.) ( 1:343/27.3)
From: Chris Brougham
To: All Msg #245, 04-Jan-89 12:33am
Subject: Midi
Last month there were a few questions regarding MIDI and C. At
one time I had the answers but now I've forgotten the questions, except
for one...it was about a book called "C Programming for MIDI" By Jim Conger.
It's published by M&T Publishing Inc. Redwood Calf, 1988. Price in
Canada $33.95. A reasonable book that gets you going. It explains
how to go about writing a simple one track MIDI recorder and includes the
source code for that example as well as the source for a patch librarian
that works with the Alpha Juno-2 synthesizer. The best part of the book is
the assembly encoded C functions that send and receive data to the MPU-401
(or clone).
For those who are interested in C programming for MIDI there is quite
a bit of information available on MIDI specific BBSes and there is the
National Echomail Midi-Net which is an invaluable source to those
intersted in this subject (usually!). One thing that should be purchased
before any programming on IBM based machines which use the MPU-401 is the
MPU Technical Reference Manual published by Roland (about $10.00).
It lists the hex commands that the device understands.
Tons (or tonnes) of things we can talk about but its getting late
so I gotta go.
---
* Origin: Energy (Opus 1:30052/3)
From: Chris Brougham
To: All Msg #246, 04-Jan-89 12:34am
Subject: Windows
Anyone know of a windowing package that works with Quick C.
I'm looking for either reference materials (books, magazine articles etc.)
that include examples of code, or some toolbox "thing" that I can use
to call ready made C functions.
Thanks in advance.
---
* Origin: Energy (Opus 1:30052/3)
From: Chris Shutters
To: Rod Whitworth Msg #247, 05-Jan-89 09:11pm
Subject: Walter and Micro C
CS> the optimizer. The one that most intrigued me was his advice on ordering
CS> of functions in sourc% dodules. He basically advocates pascal function
RW> Years ago Whitesmiths had a command called LORDER which resolved RW>
temporal
RW> dependencies in linking (unless they were circular). Does this mean the
RW> same thing? The latest MC hasn't made it here yet.
The impression I got from Walter's article was that most optimizers find it
easier to optimize a program that is written in "pascal" order; i.e. main() at
the end of the source file, with support functions appearing earlier in the
file, and the deepest nested source function appearing first.
Chris Shutters
--- msged 1.90S TC2
* Origin: Copyright (C) 1989 by Me (1:128/13.6)
*** This is a reply to #242.
From: Chuck Forsyth
To: Paul Allen Msg #248, 07-Jan-89 10:12am
Subject: Re: zortech, c++
Since I'm just getting into oops myself, let me say that c++ seems to be, at
first glance, a superset of C with major enhancements. More operators for
different and new operations, and a distinctly different perspective on how
functions are treated. Zortech has a really good offer for their compiler and
the few definitive books available on the subject. For about $200 you can find
out just about anything you'd want to know. I like the compiler, and I'm
having fun with the language.
I strongly recommend it.
cf
---
* Origin: IASD ENG BBS The Software Engineer's Exchange *HST* (Opus 1:114/18)
*** This is a reply to #137.
From: Charlie Frnka
To: Roy Tellason Msg #249, 06-Jan-89 06:48pm
Subject: Re: Programming in C
> I'd recommend "Software Tools" by Kernighan and Plauger,
> "Reliable Data
> Structures in C" by Thomas Plum, and "Variations in C" by Steven
> Schustack.
I've been looking for "Reliable Data Structures in C" for awhile now, and I've
not seen it anywhere. Is it an old book?
--- PointEd 0.30
* Origin: PointBlank (1:104/36.6)
*** This is a reply to #214.
From: Jeff Kirkley
To: All Msg #250, 08-Jan-89 03:36am
Subject: Compilers and Books
.
.
Hello again!!!! Tell me something ya'll, what do you think is the best
language out there, as far as C, Pascal, Mod-2, whatever, the selling company,
and also reference books or starting out user's manuals???
I would like to know what would be the best investment as far as compilers go?
Right now, I'm a Pascal fan, love to program in it, do it all the time in
school. Now, I have an Amy 500, w/ 512k RAM; not too much, but hey it gets
around. Talk to me, PLEASE!!!!!!!!
.
.
Jeff Kirkley
---
* Origin: The Commodore Club of Colorado Springs (Opus 1:128/29)
From: Chris Sebrell
To: Malcolm Petcher Msg #251, 05-Jan-89 06:18pm
Subject: Re: Learning C
I agree that the VAX Symbolic Debugger is good, however, it has
problems with C-Code (due to the fact that the Debugger itself
was written in C). I find it much more useful when debugging Pascal
programs than C.
-Chris Maverick Sebrell
---
* Origin: Wilton Woods OPUS Wilton,CT (HST) (203)762-8481 (Opus 1:141/250)
*** This is a reply to #232.
[251] Highest: 251
ECHO area 31 ... C language echo
Type `?' by itself for help
A)rea change N)ext (read msg) P)rior msg E)nter message
R)eply =)read non-stop -)read original +)read reply
L)ist (brief) I)nquire M)AIN MENU G)oodbye (logoff)
K)ill message U)pload
Select: y]ryMw3mr