delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
From: | "K.J.Williams" <lordwilliams1972 AT gmail DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Upgrading from a bad C compiler |
Date: | Thu, 19 Jul 2012 19:16:06 -0700 (PDT) |
Organization: | http://groups.google.com |
Lines: | 101 |
Message-ID: | <17d4b525-2c31-4c20-b3c5-a7118343e9a5@googlegroups.com> |
NNTP-Posting-Host: | 67.5.176.227 |
Mime-Version: | 1.0 |
X-Trace: | posting.google.com 1342750566 1635 127.0.0.1 (20 Jul 2012 02:16:06 GMT) |
X-Complaints-To: | groups-abuse AT google DOT com |
NNTP-Posting-Date: | Fri, 20 Jul 2012 02:16:06 +0000 (UTC) |
Complaints-To: | groups-abuse AT google DOT com |
Injection-Info: | glegroupsg2000goo.googlegroups.com; posting-host=67.5.176.227; posting-account=jrLHRgkAAABPV01ZW_RN_U6Tm5UnYNUx |
User-Agent: | G2/1.0 |
X-Received-Bytes: | 3712 |
Bytes: | 3812 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id q6K2U2o5013726 |
Reply-To: | djgpp AT delorie DOT com |
I recently upgraded, and imported some source code from a non-standard ANSI C compliant compiler (Borland Turbo C++ 3.0 for DOS) to DJGPP because of the memory limitation and the fact that TC++ far invention for accessing memory does not work. Now I am using DJGPP via RHIDE get over this disadvantage of memory, and I am running into a lot of compiler (syntax) errors because the old compiler I used was not compliant. The only difference between RHIDE and Turbo C++ that I have noticed, is that there is no verbose explanation of the errors - which I could access in TC++. Is there a documentation where I can find out more in depth what these errors mean? 3 examples of errors - simplified (2 of which I solved)- things that I could do in C in TC++ that DJGPP compiler nails me on : #1 //in myfile1.c short int myfunc(char x) { char w[0] = x;// legal in TC++ - but illegal in DJGPP, to assign the address // of x to w[0] in this manner .... .... return 0; } the fix: char w[0] = &x; #2 #define WIDGETS 200 //in myfile2.c - a global struct struct mystuff { .... .... }; struct mystuff *mything = NULL; //for use with malloc() & free() short int badstuff = 0; short int myfunc(void) { short unsigned int x; .... x = sizeof(mystuff)*WIDGETS; //legal in TC++ but illegal in DJGPP .... return 0; } the fix: x = sizeof(mything)*WIDGETS; // I don't understand why "mystuff" //doesn't work instead of using mything... #3 //in myfile3.c , declares two extern of two variables in myfile2.c outside before any function //bodies // first extern: extern short int badstuff = 0;//legal in TC++ but illegal in DJGPP // the fix is : extern short int badstuff;// but I dont understand why // second extern: extern struct mystuff *mything;//legal in TC++ but illegal in DJGPP extern mystuff *mything;//doesnt work becuase the compiler doesn't know what mystuff is extern struct mystuff;//doesnt work becuase mystuff is a struct template, not a instantiation extern mything;//doesnt work becuase it doesnt know what type mything is, and even so... //... mything is a variable not a pointer to a struct of mystuff which is what I am trying to //get recognized in myfile3.c //THIS IS WHERE I AM STUCK //please note on some download sites, TC++ is available - even though its obsolete and //non-standard ANSI compliant, it should never be used. I have it as the product that //came in a box with the books and etc. mediums to install it. Thanks In Advance, KJ
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |