Article View: comp.sys.ibm.pc.misc
Article #1894Re: TC++ Utils and mouse problems
From: Don_A_Corbitt
Date: Sat, 14 Jul 1990 05:11
Date: Sat, 14 Jul 1990 05:11
359 lines
16654 bytes
16654 bytes
> But don't be so quick to accept this as the final word...
>
> I get turbo debugger (td386) to lock up every time, and this is with
> nothing special running (no nansi.sys, etc.). It is with the same (large)
> program; I haven't tried other code yet.
>
> I haven't bothered to call them on it, given that they'll just claim
> they know nothing about it. But anyway, it fails for me regularly. :-(
>
> If anyone out there has other ideas... let's hear em.
>
> (I did call them with another problem and I am (still) very disappointed
> in Borland's tech support. On this particular program, using overlays,
> it routinely gets an exception 13 (which is nowhere documented in any
> of the Borland manuals, BTW). This happens in the startup code, i.e.,
> before main. Without overlays, it runs fine. Anyway, tech support says
> if I mail in the code, or the usual recreation-via-small-program,
> they'll look into it -- in THREE MONTHS. Geez, this program is
> scheduled for release in two! Anyway, I tried to get them to let me
> have a copy of the overlay manager source code, but they were very
> prissy about it and have so far said no way. At this point I'm
> debugging it via the disassembly, but of course having to reboot
> every time I want to quit the debugger is a major nuisance!)
>
> Andrew Burt uunet!isis!aburt
> or aburt@du.edu
Everyone,
When posting messages specific to one vendors implementation of a
language, that runs on one architecture, it is probably best to post
to a single group. The message I'm replying to was cross posted to
comp.sys.ibm.pc
comp.sys.ibm.pc.programmer
comp.os.msdos.programmer
comp.lang.c
I don't really know or care what goes on in the *.ibm.* groups, but
I cringe every time some PC user asks an _extremely_ machine/vendor
specific question in comp.lang.c. Note - I use PCs at home and at
work. I just think PC questions should be in a group where readers
are already interested in PCs. comp.lang.c is where people discuss
the C language. Not C on UNIX, C on OS/2, C on the Mac, C on Z80s,
etc. There are other groups for machine specific discussions.
Now, when you flame me about this, please read my .signature, and do
it in private. That way I can apologize in public and make you all
look mature.
As a start of an apology, I'm including a (long) answer to the question
posed above. Enjoy.
Andrew,
I don't know how well Borland is handling tech support in the backwaters
of USENET, but Compu$erve gets good support. I have a list of problems
and work-arounds, this should help you all with the common problems people
have been having. If you have any specific questions let me know, I'll
just ignore them. :-)
Standard Answers to Frequently Asked Questions
New, Improved Turbo C++
Don Corbitt (Not for BI) 74017,3244
Last changed 12 July 1990
This file has the goal of answering many of the common questions
seen on BPROGB regarding Borland Turbo C++. I don't represent
Borland, any opinions are my own.
There is a similar file called STDANS.TXT in DL5 of BPROGB. It
answers common questions that apply to TC++ and TC (and programming
in general). This file is specific to Turbo C++ version 1.0.
Overview
==============
Enable warnings.
Many programming errors can be diagnosed by the compiler. If
you enable all warning messages you have a much better chance of
writing programs that work the first time.
Formatted messages
When you leave messages regarding problems, please use the
/POST UNFORMATTED option. Otherwise, CIS (Compuserve Information
Service) will re-format your program into a jumbled mess.
RTM - Read The Manual - readme and helpme!.doc
Before spending $$$ on CIS, it is often useful to read the
documentation. Also, look at the files README and HELPME!.DOC
included with TC. They list fixes to many common programming
errors. The TC++ 1.0 manuals have a lot of good information.
HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================
If you're just getting started, and nothing seems to be working,
see these questions first:
Q23 - mouse driver incompatible
Q15 - large model and stack checking
Q4 - assembly code and 3rd party libraries
Q24 - assembly code and 3rd party libraries
Q19 - overlays and data-only modules
Q22 - overlays and exit() with C++ or atexit() functions
Q9 - editor hangs when copying blocks of text
TAPCIS
Q1. What is TAPCIS, and how does it help?
A. TAPCIS is a program that calls CIS, checks for new messages,
saves them on disk, and hangs up. Then it lets you examine the
messages at your own pace, write replies, etc. TAPCIS then calls
CIS back, and uploads replies you have written. It saves a lot
on connect charges. GO TAP for more information. It is
shareware, and registration is expected if you like it. Another
program (ATO) is free, but I haven't used it.
OS|2/Windows linking
Q2. Can I use TC for OS|2 or Windows?
A. Windows and OS/2 are both 'strategic areas' for Borland. This
means that eventually BI's main products will work under DOS,
Windows, and OS|2-PM. At this time, the outside world doesn't
know what the timetable is. It doesn't do any good to ask for
specific dates, because the people that know aren't allowed to
say. "Borland does not pre-announce product releases."
Q3. Why is this C++ program illegal?
void main() {
for (int i=0; i<10; i++)
for (int j=0; j<10; j++)
;
}
A. The AT&T C++ 2.0 specification stated that variables can't be
declared in such a way that the initializer may never execute, but
they are still in scope. Turbo C implements this 2.0 rule. This
rule was changed back in the AT&T 2.1 spec, and I expect a future
version from Borland will follow C++ 2.1.
A simple workaround is to add braces around the inner 'for' loop:
void main() {
for (int i=0; i<10; i++) {
for (int j=0; j<10; j++)
;
}
}
Q4. Why does malloc() corrupt memory?
Why does my program fail in mysterious ways?
Why does my program die when linked with TLINK 3.0, but
work with TLINK 2.0?
(etc.)
A. If you are linking in any assembly code, look for the DOSSEG
directive. DOSSEG was defined for a previous version of MSC
compilers, and is not currently needed. In fact, it conflicts
with the segment ordering of Turbo C++. Previous versions of
TLINK ignored the DOSSEG record, so they (often) worked. The
solution is to remove DOSSEG from your assembly source, and
reassemble. If you are linking with third party libraries
and don't have the source, ask them to send you a new library.
If they can't/won't, try linking in the integrated environment,
and find a new library vendor that is easier to work with! :-)
Q5. Why does qsort() give a warning/error, when it worked fine under
TC 2.0.
A. TC++ 1.0 is more strict in ANSI compliance. It is warning you
that your program may not work on certain computers. Two examples
of correct compare functions are:
/* if sorting an array of integers */
int fcmp(void const *p1, void const *p2) {
const int *ip1 = p1;
const int *ip2 = p2;
if (*ip1 < *ip2) return -1;
if (*ip1 > *ip2) return 1;
return 0;
}
/* if sorting an array of strings */
int fcmp(void const *p1, void const *p2) {
return strcmp(p1, p2);
}
Q6. When I use overlays, I get a linker warning that setjmp and
longjmp are multiply defined. Why?
A. OVERLAY.LIB includes its own setjmp and longjmp. This warning
is expected, and correct. You can disable it if you wish.
Q7. Why is Turbo Debugger 2.0 so much slower than TD 1.5?
A. For some machines, TD2 seems much slower, but not on others.
Suggestions for increasing speed are
1) disable execution history
2) update your mouse driver to latest release
3) disable use of mouse in TD
Q8. Can I place third party libraries in VROOM overlays?
A. Yes, if the vendor compiled with the -Y switch, or you have
source and recompile with -Y. If your vendor won't do so,
tell Borland and they will try to encourage them to fully
support VROOM.
Q9. When I try to copy a block in the IDE, the system hangs.
A. There is a bug in the editor - if the file ends in Ctrl-Z, the
last line is not terminated with CRLF, and there are an odd
number of chars in the last line, this will happen.
Workarounds are to terminate with CRLF, or remove the Ctrl-Z.
TC 2.0 inserts Ctrl-Z, while simply saving the file from TC++ 1.0
will strip them.
Q10. I ordered the ProPack upgrade option for $125. Why didn't I get
new TASM manuals?
A. Although TC++ 1.0 is _not_ an upgrade from TC 2.0, the Pro-Pack
part of the package (TD, TASM) is an upgrade. TASM had very few
changes, which are documented, so no new manuals were sent out.
There is a new quick reference guide, which is useful. If you
don't have TASM 1.0 manuals, you should have ordered the $145
special package which is for people that don't have the Propack,
and need all the manuals. A few people threw a tantrum when their
package arrived sans TASM manuals. Borland agreed to send them
TASM 2.0 manuals, and make sure any future purchasers know what
each order contains.
Q11. I ordered the upgrade through Borland for $xxx, and the next week
I found the same package for $xxx-10 at the local "Software Is Us"
store? Why is Borland ripping off its loyal customers!!!!!
A. There are two parts to this answer...
1) Take a deep breath, count to ten, exhale slowly.
Now that you feel more relaxed...
2) C++ is a new product, so the special deals for past customers
are not as special. Each store/distributor is free to charge
what it wishes for software, including selling at or below
cost. Since they buy in huge quantity, they get very
good prices, and handling/postage is much lower than
individual sales. So I recommend checking with your local
discount house before placing an order direct to Borland.
PS - Egghead Software had a typo in their advertisements.
It looked like they were selling TC++ Pro Pack for $90,
when it was really just TC++ 1.0, no TASM/TD/TProf, etc.
Q12. What happened to the inportb() and outportb() inline macros
in dos.h?
A. They accidentally got left out. You can copy the definitions
below into dos.h. BTW, there are also definitions for word IO,
but they don't work correctly in this release of the compiler.
void _Cdecl outportb(int portid, unsigned char value);
void _Cdecl __outportb__ (int portid, unsigned char value);
#define outportb(portid, v) __outportb__(portid,v)/* Byte OUT instruction */
unsigned char _Cdecl inportb(int portid);
unsigned char _Cdecl __inportb__ (int portid);
#define inportb(portid) __inportb__(portid)/* Byte IN instruction */
Q13. Why does varargs require that arguments be on the stack?
A. I don't know, but many months ago someone from Borland asked if that
would be a reasonable requirement, and no one could think of a
reason why not. (Since then, someone obviously has :-).
Q14. Why does linking with WILDARGS.OBJ cause my program to crash?
A. There appears to be a bug using WILDARGS.OBJ and large model
programs. Expect a fix shortly. Found by Hyman Rosen
74716,3415.
Q15. Why does my large model program not work?
A. If stack checking is enabled, turn it off. Stack check in
large model is said to not work properly.
Q16. What is a good book for learning C++ programming?
A. C++ Primer, Stanley B. Lippman, ISBN 0-201-16487-6.
Q17. Why does the linker complain about missing functions when
I use C++ streams?
A. If you have selected Unsigned Chars:ON, change back to off,
or edit the <iostream.h> file on lines 577, 593, 597 to be
(const signed char *) in place of (const char *).
Q18. Where are the programs TCCNVT.EXE and PRJ2MAKE.EXE?
A. These utilities were not completed in time for shipment, and
should have been removed from the manuals. There is no
information on future plans regarding them.
Q19. Why does my program crash when I link with overlays, but work
ok without them?
A. Are you overlaying any modules that are data-only? Create a
detailed .MAP file, and see if any of the code segments being
overlayed are 0 bytes long. If so, don't overlay that module.
Q20. Why doesn't the preprocessor 'stringize' my macro? This works
OK in TC 2.0:
#define TEMP 5
#define STR(x) #x
printf("TEMP is %s\n", STR(TEMP));
A. ANSI has defined how the preprocessor converts macros. This will
work:
#define STR(x) STR1(x)
#define STR1(x) #x
Q21. Why doesn't MK_FP work the same way?
A. For most arguments to the MK_FP macro you will get the same results.
However, if you are passing a long value, you may get something
unexpected. You should pass two integers as parameters.
Q22. I'm using overlays and C++. Why does my system crash when exit() is
called?
A. There is a bug in c0.asm. Either don't call exit() when using overlays
and C++, or make this change to c0.asm, and run BUILDC0.BAT.
To change your c0.asm, follow these steps:
1) unzip the file STARTUP.ZIP in /turboc/examples
2) edit C0.ASM, moving these lines
mov byte ptr cs:JA_JB,72h
mov byte ptr cs:StartExit+1,0
to before the
call _main
3) run the BUILD-C0 batch file
4) link with the new C0x.OBJ file
Q23. Nothing seems to be working. I get crashes when compiling, or
running program that seemed to work before. What's wrong?
A. A common cause of mysterious crashes is using an old mouse driver.
TC (and TD, TProf, etc) use some mouse driver features that old
mice don't have. This allows them to share the mouse between the
program being tested, and TC. An old driver can cause various
problems.
You can get new drivers at these locations:
Mouse Systems Version (415) 683-0617
Logitech Version 4.1 ????
Microsoft Version ????
Q24. Why am I getting memory overwrites at run time?
A. If you link any code that defines CONST segments this will
confuse TLINK. Either you need to add CONST segments to
the proper place in C0.ASM, or remove the CONST segments
from your code.
Q25. How can I tell if I'm linking in improper assembly routines?
A. Create a detailed map file. The segment order should in
general be as follows:
Start Stop Length Name Class Comments
00000H 00433H 00434H _TEXT CODE One or more CODE segments
01AC5H 01D13H 0024FH TZSET_TEXT CODE
01D20H 022C2H 005A3H _DATA DATA One or more DATA segments
022CEH 022D9H 0000CH _SCNSEG DATA
022DAH 02367H 0008EH _BSS BSS The _BSS segment
02368H 02368H 00000H _BSSEND STACK Then _BSSEND with class STACK
02370H 023EFH 00080H _STACK STACK Then finally STACK
Q26. TLink crashes when linking in my own ASM file?
A. If you enabled debugging symbols (/zi), and have multiple symbols
with the same name (@@1:, etc) this may confuse TLINK. Change
the symbol names, or use the (/zd) option.
If any of this information is outdated, or not correct, or if you
have any suggestions for other items to cover, please let me know.
I will try to update this file (and STDANS.TXT on DL5) several times
a year, but only if I get the feeling it is useful to others.
Don Corbitt 74017,3244
Sunnyvale, California
---
Don_A_Corbitt@cup.portal.com Not a spokesperson for CrystalGraphics, Inc.
Mail flames, post apologies. Support short .signatures, three lines max.
Technical Details
Message-ID:
<31702@cup.portal.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!bionet!ames!sparkyfs!hercules!fernwood!portal!cup.portal.com!Don_A_CorbittReferences:
<46500140@uxa.cso.uiuc.edu> <647@cvbnetPrime.COM> <AV.90Jul12093734@kielo.uta.fi> <7790@tekgvs.LABS.TEK.COM> <4029@isis.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!bionet!ames!sparkyfs!hercules!fernwood!portal!cup.portal.com!Don_A_Corbitt From: Don_A_Corbitt@cup.portal.com Newsgroups: comp.sys.ibm.pc.misc,comp.os.msdos.programmer Subject: Re: TC++ Utils and mouse problems Message-ID: <31702@cup.portal.com> Date: 14 Jul 90 05:11:52 GMT References: <46500140@uxa.cso.uiuc.edu> <647@cvbnetPrime.COM> <AV.90Jul12093734@kielo.uta.fi> <7790@tekgvs.LABS.TEK.COM> <4029@isis.UUCP> Organization: The Portal System (TM) Lines: 359