Hi!
26-Дек-2004 16:00 [EMAIL PROTECTED] (Alain) wrote to
[email protected]:
>> Earlier, there was recommended Borland C++ 3.1. But it is very outdated
A> I remember that you had a list of BC 3.1 bugs, could you send it to us,
A> please?
______________O\_/_________________________________\_/O______________
Notes about codegenerator of BC++ 3.1:
turboc.cfg: -C -d -Ff -mc -N -O1 -Z- -V -Vmv -v- -vi -w
1. Incorrectly works declarator "_fastcall" for class methods - arguments
pushed to stack in order, incomparable with order of handling parameters
in the method.
FIX: not use "-po" option and "_fastcall" for methods.
2. Result of intrinsic-version of "memcmp" function undefined when third
argument is zero.
FIX: check size of compared memory blocks before "memcmp".
3. Losted initialization for all, except last, variables, groupped in one
definition in the inline-function. For example:
inline void f() { int a = 1, b = 2, c = 3; g(a, b, c); }
be inlined as:
{ int a, b, c = 3; g(a, b, c); }
FIX: split variables by different definitions: { int a = 1; int b = 2; ...
4. (char _seg*)0x60 expression makes 0:0x60 pointer instead 0x60:0.
FIX: for constants instead _seg use MK_FP (MK_FP(0x60,0)).
Notes about header files and libraries of BC++ 3.1:
1. In dos.h at lines 310, 320 and 345 used modifier "far" directly, not
through "_FAR", therefore with -A option (ANSI-compatible code)
compiler generates error messages.
FIX: not use -A option or create wrapper for dos.h, where before
inclusion dos.h define empty macroses "far", "near" and "cdecl" in case,
when defined "__STDC__" macros.
2. Value "ENMFILE" (No more files), returned by MS-DOS, in the "errno"
replaced by "ENOENT" (No such file or directory).
FIX: after findfirst/findnext functions check "_doserrno", but not "errno".
3. Value "ENODEV" (No such device), returned by MS-DOS, in the "errno"
replaced by "EXDEV" (Cross-device link).
FIX: after getcurdir function check "_doserrno", but not "errno".
Notes about utilities BC++ 3.1:
1. Bug in MAKE sometime not allow use accumulation ({} operation in
implicit rules) - for example, for ECHO with accumulation at some
moment may appear message about inability to execute command.
FIX: not use {} operation.
_____________________________________________________________________
O/~\ /~\O
Some test sources:
dosh.cpp - Compilation as ANSI compliant
fastcall.cpp - __fastcall and methods test
gpfault1.cpp - GP FAULT test
gpfault2.cpp - GP FAULT test
gpfault3.cpp - GP FAULT test
lostcnst.cpp - const conversion test
quiet.cpp - void in expression
regcopy.cpp - -Z option (suppress redundant load) test
______________O\_/_________________________________\_/O______________
/****************************************************************/
/* BUG (BC++ 3.1): Compilation as ANSI compliant */
/****************************************************************/
#include <dos.h>
int main() { return 0; }
/*
Error dos.h 310: Expression syntax
Error dos.h 311: ) expected
Error dos.h 320: Expression syntax
Error dos.h 321: ) expected
Error dos.h 345: Size of '_harderr' is unknown or zero
Error dos.h 345: Illegal initialization
Error dos.h 345: ) expected
*/
/* turboc.cfg: -C -d -Ff -mc -N -O1 -Z- -V -Vmv -v- -vi -w */
_____________________________________________________________________
O/~\ /~\O
______________O\_/_________________________________\_/O______________
/****************************************************************/
/* BUG (BC++ 3.1): __fastcall and methods test */
/****************************************************************/
struct X *tx; char *near ts, *near s = "test";
struct X { void __fastcall f(char *near); } x;
void __fastcall X::f(char *near s) { tx = this; ts = s; }
#include <stdio.h>
int main(){
x.f(s);
printf("Must be: [%p, %p]; now: [%p, %p] - %s\n",
&x, s, tx, ts, &x == tx ? "Ok" : "FAIL");
return 0;
}
/* When -mc option result:
Must be: [0A98:0390, 0A98:0098]; now: [0A98:0098, 0A98:0390] - FAIL
When -mt -lt option result:
Must be: [1912, 1664]; now: [1664, 1912] - FAIL
*/
/* turboc.cfg: -C -d -Ff -mc -N -O1 -Z- -V -Vmv -v- -vi -w */
_____________________________________________________________________
O/~\ /~\O
______________O\_/_________________________________\_/O______________
/****************************************************************/
/* BUG (BC++ 3.1): GP FAULT test */
/****************************************************************/
//void callBug(void);
void f() { callBug(); }
void callBug() {}
void main() { callBug(); }
/* When compiling, BCC gives next message:
Error gpfault.cpp 7: Function 'callBug' should have a prototype in function f()
FATAL ERROR: GP FAULT
*/
/* turboc.cfg: -C -d -Ff -mc -N -O1 -Z- -V -Vmv -v- -vi -w */
_____________________________________________________________________
O/~\ /~\O
______________O\_/_________________________________\_/O______________
/****************************************************************/
/* BUG (BC++ 3.1): GP FAULT test */
/****************************************************************/
struct DDEACK { unsigned bAppReturnCode :8; };
struct DdeAck :public DDEACK { DdeAck(int, unsigned) {} };
DdeAck Success0(void) { return DdeAck(1, 0); }
DDEACK Success1(void) { return *(DDEACK*)&DdeAck(1, 0); }
#ifdef _BUG0_
DDEACK Failure0(void) { return DdeAck(1, 0); }
#endif
#ifdef _BUG1_
DDEACK Failure1(void) { return DDEACK(DdeAck(1, 0)); }
#endif
/* When compiling with -D_BUG0_ or -D_BUG1_, BCC gives next message:
FATAL ERROR: GP FAULT
*/
/* turboc.cfg: -C -d -Ff -mc -N -O1 -Z- -V -Vmv -v- -vi -w */
_____________________________________________________________________
O/~\ /~\O
______________O\_/_________________________________\_/O______________
/****************************************************************/
/* BUG (BC++ 3.1): GP FAULT test */
/****************************************************************/
void a(int a) { static int a; }
/* When compiling, BCC gives next message:
Error gpfault3.cpp 5: Multiple declaration for 'a' in function a(int)
FATAL ERROR: GP FAULT
*/
/* turboc.cfg: -C -d -Ff -mc -N -O1 -Z- -V -Vmv -v- -vi -w */
_____________________________________________________________________
O/~\ /~\O
______________O\_/_________________________________\_/O______________
/****************************************************************/
/* BUG (BC++ 3.1): const conversion test */
/****************************************************************/
struct X{
X &operator[] (int) { puts("X[]"); return *this; }
const X &operator[] (int) const { puts("const X[]"); return *this; }
};
#include <stdio.h>
void main(){
X x; const X cx;
x[1]; cx[1]; ((const X)x)[1];
}
/* Result (3rd line must contain "const X[]"):
X[]
const X[]
X[]
*/
/* turboc.cfg: -C -d -Ff -mc -N -O1 -Z- -V -Vmv -v- -vi -w */
_____________________________________________________________________
O/~\ /~\O
______________O\_/_________________________________\_/O______________
/****************************************************************/
/* BUG (BC++ 3.1): void in expression */
/****************************************************************/
void a() {}
void main() { while(a()); }
/* This compiled quietly, without errors and warnings */
/* turboc.cfg: -C -d -Ff -mc -N -O1 -Z- -V -Vmv -v- -vi -w */
_____________________________________________________________________
O/~\ /~\O
______________O\_/_________________________________\_/O______________
/****************************************************************/
/* BUG (BC++ 3.1): -Z option (suppress redundant load) test */
/****************************************************************/
#pragma option -Z
#define isdigit(c) ((c) >= '0' && (c) <= '9')
unsigned s2v(const char s[], unsigned &len){
unsigned v = s[--len] - '0';
if(len && isdigit(s[len - 1])) { v += 10 * (s[--len] - '0'); }
return v;
}
/* After (len=2;s2v("00",len)) len must be equal to 0, but BC++ 3.1
optimizer with -Z forgives to save second decremented len value
*/
/* turboc.cfg: -C -d -Ff -mc -N -O1 -Z- -V -Vmv -v- -vi -w */
_____________________________________________________________________
O/~\ /~\O
And, last item (letter with some Russian words) in my collection (but
not last known or unknown bug/trouble in BC):
______________O\_/_________________________________\_/O______________
Newsgroups: relcom.fido.su.c-c++
Subject: [NEWS] Ошибка компилятора BC++ 4.5???
>> -+--+--+--+--+--+--+--+--[cut here]-+--+--+--+--+--+--+--+--
>> #include <iomanip.h>
>>
>> class TestClass
>> {
>> public:
>> TestClass();
>> ~TestClass();
>> static int TestMethod();
>> };
>>
>> TestClass::TestClass()
>> {
>> cout << "In TestClass constructor..." << endl;
>> }
>>
>> TestClass::~TestClass()
>> {
>> cout << "In TestClass destructor..." << endl;
>> }
>>
>> int TestClass::TestMethod()
>> {
>> cout << "In TestClass::TestMethod..." << endl;
>> return 1;
>> }
>>
>> int main(int,char**)
>> {
>> int i;
>> cout << "Starting program..." << endl;
>> i=TestClass().TestMethod();
>> cout << "Exiting program..." << endl;
>> return i;
>> }
>> -+--+--+--+--+--+--+--+--[cut here]-+--+--+--+--+--+--+--+--
>>
>> А вот ее выдача:
>>
>> -+--+--+--+--+--+--+--+--[cut here]-+--+--+--+--+--+--+--+--
>> Starting program...
>> In TestClass::TestMethod...
>> In TestClass destructor...
>> Exiting program...
>> -+--+--+--+--+--+--+--+--[cut here]-+--+--+--+--+--+--+--+--
AK> Та же ошибка есть в bc 3.1.
AK> Ошибкой является отсутствие вызова конструктора для временного обьекта.
_____________________________________________________________________
O/~\ /~\O
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel