dev-cpp-users Mailing List for Dev-C++ (Page 597)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(15) |
Oct
(115) |
Nov
(154) |
Dec
(258) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(377) |
Feb
(260) |
Mar
(249) |
Apr
(188) |
May
(152) |
Jun
(150) |
Jul
(195) |
Aug
(202) |
Sep
(200) |
Oct
(286) |
Nov
(242) |
Dec
(165) |
| 2002 |
Jan
(245) |
Feb
(241) |
Mar
(239) |
Apr
(346) |
May
(406) |
Jun
(369) |
Jul
(418) |
Aug
(357) |
Sep
(362) |
Oct
(597) |
Nov
(455) |
Dec
(344) |
| 2003 |
Jan
(446) |
Feb
(397) |
Mar
(515) |
Apr
(524) |
May
(377) |
Jun
(387) |
Jul
(532) |
Aug
(364) |
Sep
(294) |
Oct
(352) |
Nov
(295) |
Dec
(327) |
| 2004 |
Jan
(416) |
Feb
(318) |
Mar
(324) |
Apr
(249) |
May
(259) |
Jun
(218) |
Jul
(212) |
Aug
(259) |
Sep
(158) |
Oct
(162) |
Nov
(214) |
Dec
(169) |
| 2005 |
Jan
(111) |
Feb
(165) |
Mar
(199) |
Apr
(147) |
May
(131) |
Jun
(163) |
Jul
(235) |
Aug
(136) |
Sep
(84) |
Oct
(88) |
Nov
(113) |
Dec
(100) |
| 2006 |
Jan
(85) |
Feb
(119) |
Mar
(33) |
Apr
(31) |
May
(56) |
Jun
(68) |
Jul
(18) |
Aug
(62) |
Sep
(33) |
Oct
(55) |
Nov
(19) |
Dec
(40) |
| 2007 |
Jan
(22) |
Feb
(49) |
Mar
(34) |
Apr
(51) |
May
(66) |
Jun
(43) |
Jul
(116) |
Aug
(57) |
Sep
(70) |
Oct
(69) |
Nov
(97) |
Dec
(86) |
| 2008 |
Jan
(32) |
Feb
(47) |
Mar
(106) |
Apr
(67) |
May
(28) |
Jun
(39) |
Jul
(31) |
Aug
(25) |
Sep
(18) |
Oct
(25) |
Nov
(5) |
Dec
(21) |
| 2009 |
Jan
(33) |
Feb
(27) |
Mar
(27) |
Apr
(22) |
May
(22) |
Jun
(10) |
Jul
(17) |
Aug
(9) |
Sep
(21) |
Oct
(13) |
Nov
(4) |
Dec
(11) |
| 2010 |
Jan
(10) |
Feb
(8) |
Mar
(4) |
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(26) |
Nov
(9) |
Dec
(1) |
| 2011 |
Jan
(21) |
Feb
(16) |
Mar
(4) |
Apr
(19) |
May
(26) |
Jun
(9) |
Jul
(6) |
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(2) |
Dec
(1) |
| 2012 |
Jan
(4) |
Feb
(7) |
Mar
(4) |
Apr
|
May
(1) |
Jun
(10) |
Jul
(1) |
Aug
(1) |
Sep
(18) |
Oct
(3) |
Nov
(1) |
Dec
(1) |
| 2013 |
Jan
(4) |
Feb
(2) |
Mar
(15) |
Apr
(6) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
(9) |
Dec
|
| 2014 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
(4) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
(4) |
| 2015 |
Jan
(2) |
Feb
(3) |
Mar
(1) |
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(9) |
Nov
(35) |
Dec
(6) |
| 2016 |
Jan
(7) |
Feb
(10) |
Mar
(10) |
Apr
(9) |
May
(13) |
Jun
(9) |
Jul
(1) |
Aug
(3) |
Sep
(3) |
Oct
(1) |
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Ioannis V. <no...@ho...> - 2002-04-20 17:24:37
|
-----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Bob Wilson Sent: Wednesday, April 17, 2002 9:29 PM To: Dev-C++ User Mailing List Subject: Fw: [Dev-C++] enum Absolutely correct, but when you assign a value to an enumerated element, it practically destroys or greatly limits the ability to use the enumerated elements in a for loop or switch statement. Why you can't use them in a switch statement? In fact a switch statement is one of the common uses for enums. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net <http://www.noicys.cjb.net/> * Alternative URL: http://run.to/noicys |
|
From: Dennis M. <mmi...@co...> - 2002-04-20 16:12:26
|
unsubscribe |
|
From: Daniel G. <sp...@ho...> - 2002-04-20 16:11:05
|
Try declaring the second overloaded function at the start of the program.
>From: "Blagger" <car...@sk...>
>To: <dev...@li...>
>Subject: [Dev-C++] Begginer's question, Function overloading
>Date: Sat, 18 Apr 2015 20:06:14 +0200
>
>Hi
>
>As a beginner I came to the chapter "function overloading" of a C++
>handbook
>and had the following exercise.
>The problem with this listing is that dev-C++ gives me the errors :
>110 too many arguments to function double f-seize(double,double)
>320 at this point in line.
>
>I know this, that's why it's called function overloading, or am I
>completely
>wrong ?
>Thanks in advance for any help.
>
>10 // computing clothes size
>20 // excercise on functions with function overloading
>30
>40 #include <stdio.h>
>50 #include <iostream.h>
>60 #include <conio.h>
>70 #include <math.h>
>80
>90 double hat_seize(double h_weight,double h_height);
>100 // first function returns hat-seize
>110 double f_seize(double j_weight,double j_years);
>120 // second function returns Waist in inches
>130 // when overloaded and returns also Jacket seize
>140
>150 int main(int argc, char *argv[])
>160 {
>170 cout.setf(ios::fixed);
>180 cout.setf(ios::showpoint);
>190 cout.precision(1);
>200 char answer = 'y';
>210 double height, weight, age, h_seize,j_seize,w_seize;
>220
>230 do
>240 {
>250 cout << "\nTyp hier uw lengte in (in cm) : "; cin >> height;
>260 cout << "\nTyp hier uw gewicht in (in kg) : "; cin >> weight;
>270 cout << "\nTyp hier uw leeftijd in (jaren) : "; cin >> age;
>280 cout << "\nEffe wachtte" << endl;
>290 h_seize = hat_seize(weight,height);
>300 w_seize = f_seize(weight,age);
>310 // now we overload the second function :
>320 j_seize = f_seize(weight,height,age);
>330 cout << "\n De grootte van uw hoed : "; cin >> h_seize;
>340 cout << "\n De grootte van uw jas : "; cin >> j_seize;
>350 cout << "\n De grootte van uw broek : "; cin >> w_seize; cout <<
>endl;
>360 cout << "\n\tNogmaals? (Y/N) : "; cin >> answer;
>370
>380 }
>390 while ((answer == 'Y') || (answer == 'y'));
>400
>410 getch();
>420
>430 return 0;
>440 }
>450
>460 // first function calculates hat-size
>470 double hat_seize(double h_weight,double h_height)
>480 {
>490 return ((h_weight / h_height) * 2.9);
>500 }
>510
>520 //Second function (normal)
>530 double f_seize(double j_weight,double j_years)
>540 {
>550 return ((j_weight/5.7) + (floor((j_years - 28)/2)/10));
>560 }
>570 //Second function (overloaded)
>580 double f_seize(double j_weight,double j_height, double j_years)
>590 {
>600 return (((j_weight * j_height)/288) + (floor((j_years - 30)/10)/8));
>610 }
>
>
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
|
|
From: Bob W. <bo...@ph...> - 2002-04-20 16:10:47
|
Andres, If it is GNUC extension, that greatly relieves my concern, however none = of the compiler switches you mention generate any warnings. I tried them = individually and in combination in both the compiler options and the = project options. It is possible that the Bloodshed IDE is not passing = the switches properly to the compiler, but I doubt it.=20 Regards, Bob -Yes. Variable sized arrays are GNUC extension. If you use =96ansi or =96pedantic switches on commandline, you get = only warning: =20 test.cpp: In function `int main()': test.cpp:12: warning: ANSI C++ forbids variable-size array `myArray' |
|
From: Andres R. <lo...@ho...> - 2002-04-20 13:11:42
|
Senond: You can always check out http://msdn.microsoft.com/ There you have all things (manuals, examples, etc.) needed for programming with MSVC and even with Dev-C++, if you can filter out the MS crap ;) First: I can't help you with XP question, because I really hate that system. One reason is it has NO support for older ( I mean DOS ) programs what so ever. And it did not run some OpenGL programs either.. So I booted to Linux and did same cool moves with fdisk and after taht a format wos an issue. Your'e welcome! Andres. -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Kenneth Armstrong Sent: Saturday, April 20, 2002 6:59 AM To: dev...@so... Subject: [Dev-C++] 2 easy questions first: can MSVC++ run (well) on windows xp pro? (probably a stupid question, but i've heard that xp has a few compatability problems) second: since MSVC++ doesn't really come with any manuals (at least mine didn't) what is the best book to get for it? (eg. Programmer's Guide, ect.) thanx in advance for any help |
|
From: Andres R. <lo...@ho...> - 2002-04-20 13:02:13
|
Yes. Variable sized arrays are GNUC extension. If you use =96ansi or =96pedantic switches on commandline, you get only warning: =20 test.cpp: In function `int main()': test.cpp:12: warning: ANSI C++ forbids variable-size array `myArray' =20 Andres =20 -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Abhijit Shylanath Sent: Saturday, April 20, 2002 1:21 PM To: Dev-C++ User Mailing List Subject: Re: [Dev-C++] Dev-C++ Users Beware! =20 Quote Microsoft: "This isn't a bug, it's a feature." Seriously, though, this is one feature of the GCC compiler (I remember reading about it in the DJGPP docs). If you're still looking for the compiler to stop when it encounters non-ANSI code, there must be a command-line options somewhere. Yup, here it is... from the Dev-C++ help file. _____ =20 - Support all ANSI C standard programs (compiler parameter : -ansi): =20 This turns off certain features of GNU C that are incompatible with ANSI C, such as the asm, inline and typeof keywords, and predefined macros such as unix and vax that identify the type of system you are using. It also enables the undesirable and rarely used ANSI trigraph feature, and it disables recognition of C++ style // comments. _____ =20 But what the hell, GCC is kind of a standard in itself. mdeth * m.o.t.o[P.S.Y.C.H.O]=20 http://mudeth.tripod.com | ibr...@bi... | mu...@gm... ----- Original Message -----=20 From: Bob Wilson <mailto:bo...@ph...> =20 To: Dev-C++ User Mailing List <mailto:dev...@li...> =20 Sent: Saturday, April 20, 2002 3:29 AM Subject: [Dev-C++] Dev-C++ Users Beware! =20 David, An array is not dynamic, the value you pass it at initalization must be a constat of some sort.if 'i' were to change during the program some weird voodoo (the program will crash,the world will end,etc.) all this will hapen because it cannot change the size of an array at runtime(reason no. 1 linked lists were created) I am in the process of learning C++, as Ioannis well knows, and a week or so ago I was working on the array chapter. In the past I have done most of my programming in pascal, and every pascal compiler I have used will not compile an array if the size of the array is a variable, i.e., no dynamic arrays. Just fooling around I modified the simple little C++ array program to define an array with a variable. I had not done any research but was confident that the compiler would flag an error and bail out.=20 =20 Not So! the program compiled and ran allowing me to change the size of the array. I tested the bounds of the program and could build quite large arrays. the size_of function always returnd the correct size of the array. I was really surprised because that it worked. I have not employed the technique in any real world program, because I felt that it would be much safer with pointers and linked lists.=20 =20 Your message above confirmed what I suspected but had not taken the time to investigate. Stroustrup says: The number of elements of the array, the array bound, must be a constant expresseion (=A7C.5) Paragraph C.5 says in part: A constant expression evaluates to an integral of enumeration constant. Such an expression is composed of literals, enumerators, and const initialized by constant expressions. < . . . > Intuitively, constant expressions are simple expressions that can be evaluated by the compiler before the program is linked and starts to run. That tells me that the compiler should have caught this and bailed out rather than compiling, linking, and running this program:=20 =20 #include <iostream.h> #include <stdlib.h> =20 int main { int arraySize =3D 1; std::cout << "Enter the size of the array: "; std::cin >> arraySize; if (!(arraySize > 0)) { system("pause"); return 0; } int myArray[arraySize]; int arrayLength =3D sizeof(myArray)/sizeof(myArray[0]); for (int i=3D0; i < arrayLength; i++) // 0 to arrayLength-1 { myArray[i] =3D (i + 1) * 2 + 1; } for (int i=3D0; i< arrayLength; i++) // 0 to arrayLength-1 { std::cout << i << ": " << myArray[i] << "\n"; } =20 system("pause"); return 0; } The faulty compiler is the one used by Bloodshed. Visual C++ 6.0 caught the error. That is the second and most serious problem I have found with the compiler used by the dev-c++ environment. It appears it will properly compile ANSI standard code, but it will also compile code that is clearly outside of the standard.=20 =20 I believe that the dev-c++ compiler is the mingw compiler.=20 =20 Regards, =20 Bob Wilson =20 |
|
From: Graeme F. <gr...@dr...> - 2002-04-20 12:47:00
|
On a slightly different tack, it is often desirable to have a header file included multiple times. However that may cause problems if you end up with multiple definitions. To avoid that header guards should be used. These will have a pre-processor directive around the entire file #ifndef __MyHeaderFile_H #define __MyHeaderFile_H // add some declarations and definitions here... #endif This will expand the code only once but allow the file to be included multiple times. Now all you have to be wary of is circular #includes, where file A includes B and B includes A. That causes the compiler to get terribly frustrated. Graeme. |
|
From: Graeme F. <gr...@dr...> - 2002-04-20 12:46:45
|
The CDialog1::CDialog1(CWnd* pParent /*=NULL*/) is the constructor for the CDialog1 class. Now because this class will inherit from the CDialog class it must be able to call the default constructor for the CDialog class. However this class probably doesn't have a default constructor, in which case the constructor has to be called explicitly, hence the line : CDialog(CDialog1::IDD, pParent) which calls the CDialog constructor passing it IDD a static variable from CDialog and pParent argument passed in. Now that the CDialog constructor has been called the rest of the CDialog1 constructor can be executed. >>What does it mean when you have the scope resolution operator and the single >>: in the same bit of code? >> >>e.g. >> >>CDialog1::CDialog1(CWnd* pParent /*=NULL*/) >> : CDialog(CDialog1::IDD, pParent) >> >>? |
|
From: Abhijit S. <mu...@gm...> - 2002-04-20 10:43:03
|
Quote Microsoft: "This isn't a bug, it's a feature." Seriously, though, = this is one feature of the GCC compiler (I remember reading about it in = the DJGPP docs). If you're still looking for the compiler to stop when = it encounters non-ANSI code, there must be a command-line options = somewhere. Yup, here it is... from the Dev-C++ help file. -------------------------------------------------------------------------= ------- - Support all ANSI C standard programs (compiler parameter : -ansi): This turns off certain features of GNU C that are incompatible with ANSI = C, such as the asm, inline and typeof keywords, and predefined macros = such as unix and vax that identify the type of system you are using. It = also enables the undesirable and rarely used ANSI trigraph feature, and = it disables recognition of C++ style // comments. -------------------------------------------------------------------------= ------- But what the hell, GCC is kind of a standard in itself. mdeth O m.o.t.o[P.S.Y.C.H.O]=20 http://mudeth.tripod.com | ibr...@bi... | mu...@gm... ----- Original Message -----=20 From: Bob Wilson=20 To: Dev-C++ User Mailing List=20 Sent: Saturday, April 20, 2002 3:29 AM Subject: [Dev-C++] Dev-C++ Users Beware! David, An array is not dynamic, the value you pass it at initalization must = be a constat of some sort.if 'i' were to change during the program some = weird voodoo (the program will crash,the world will end,etc.) all this = will hapen because it cannot change the size of an array at = runtime(reason no. 1 linked lists were created) I am in the process of learning C++, as Ioannis well knows, and a week = or so ago I was working on the array chapter. In the past I have done = most of my programming in pascal, and every pascal compiler I have used = will not compile an array if the size of the array is a variable, i.e., = no dynamic arrays. Just fooling around I modified the simple little C++ = array program to define an array with a variable. I had not done any = research but was confident that the compiler would flag an error and = bail out.=20 Not So! the program compiled and ran allowing me to change the size of = the array. I tested the bounds of the program and could build quite = large arrays. the size_of function always returnd the correct size of = the array. I was really surprised because that it worked. I have not = employed the technique in any real world program, because I felt that it = would be much safer with pointers and linked lists.=20 Your message above confirmed what I suspected but had not taken the = time to investigate. Stroustrup says: The number of elements of the array, the array bound, must be a = constant expresseion (=A7C.5) Paragraph C.5 says in part: A constant expression evaluates to an integral of enumeration = constant. Such an expression is composed of literals, enumerators, and = const initialized by constant expressions. < . . . > Intuitively, = constant expressions are simple expressions that can be evaluated by the = compiler before the program is linked and starts to run. That tells me that the compiler should have caught this and bailed out = rather than compiling, linking, and running this program:=20 #include <iostream.h> #include <stdlib.h> int main { int arraySize =3D 1; std::cout << "Enter the size of the array: "; std::cin >> arraySize; if (!(arraySize > 0)) { system("pause"); return 0; } int myArray[arraySize]; int arrayLength =3D sizeof(myArray)/sizeof(myArray[0]); for (int i=3D0; i < arrayLength; i++) // 0 to arrayLength-1 { myArray[i] =3D (i + 1) * 2 + 1; } for (int i=3D0; i< arrayLength; i++) // 0 to arrayLength-1 { std::cout << i << ": " << myArray[i] << "\n"; } =20 system("pause"); return 0; } The faulty compiler is the one used by Bloodshed. Visual C++ 6.0 = caught the error. That is the second and most serious problem I have = found with the compiler used by the dev-c++ environment. It appears it = will properly compile ANSI standard code, but it will also compile code = that is clearly outside of the standard.=20 I believe that the dev-c++ compiler is the mingw compiler.=20 Regards, Bob Wilson |
|
From: Abhijit S. <mu...@gm...> - 2002-04-20 10:42:56
|
Thanks for the help, Lorenzo and Francky... it turns out that the DLL = was there in a folder called 'DLL' (d'oh)... stupid WinXP search was set = to no sub-dir search. I found it when I was testing a program that I = wrote to index files on CDs... guess I'm better than MS, eh? Also, = there's a new option when I create a new project in Dev-C++... it says = 'Allegro projects' and gives me options to link the lib in statically. = Also, the END_OF_MAIN(); isn't necessary when using WinMain(). mdeth O m.o.t.o[P.S.Y.C.H.O]=20 http://mudeth.tripod.com | ibr...@bi... | mu...@gm... |
|
From: Norman G. <no...@ju...> - 2002-04-20 07:40:11
|
On Fri, 19 Apr 2002 23:36:00 +0100 "Jason Hardman" <jas...@bt...> writes: > ... The version of GCC that MinGW supplies is 2.?? ... Version 2.95. Although gcc is currently up to the 3.11 or somewhere near that, there seems to be a few problems with the latest releases. > ... The current MinGW version is not 100% standards compliant ... Actually, gcc is said to be the most compliant (to ANSI C++ standards) major C++ compiler around. Mingw, however, is not a full implementation of gcc. It depends on a certain Microsoft dll (msvcrt.dll - Microsoft's C runtime library) to generate Windows console programs, and therefore has the limitations of that dll. Mingw is even less complete for Windows programs, because of the w32api libraries and "include" files it uses. It should be noted that all the major compilers (Borland C++ 5.5, MSVC++ 6.0, gcc 3.11, etc) go way beyond mere ANSI compliance, and that their additional features do not make them non-compliant. None of them are 100% ANSI compliant, however, with the least compliant said to be MSVC++ 6.0. The bottom line is that, at the beginner's level (which generally means console programs) there is very little difference between the major compilers. You simply have to learn the peculiarities of your compiler/operating system combination. Given this, gcc (or mingw) is just as good as any other compiler for compiling console programs. Norm |
|
From: Kenneth A. <dig...@ho...> - 2002-04-20 03:58:55
|
first: can MSVC++ run (well) on windows xp pro? (probably a stupid question, but i've heard that xp has a few compatability problems) second: since MSVC++ doesn't really come with any manuals (at least mine didn't) what is the best book to get for it? (eg. Programmer's Guide, ect.) thanx in advance for any help _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx |
|
From: Jason H. <jas...@bt...> - 2002-04-20 00:11:36
|
Something people using Dev-C++ may not realise is that the supplied = compiler is MinGW and that it is a port of the GCC compilers as used on = linux and many other unix based OS's. The version of GCC that MinGW = supplies is 2.?? (I can't remember the exact number) which is fairly old = now, as the current linux version of GCC is 3.??. The current MinGW version is not 100% standards compliant because of = this, and I believe also that the developers of GCC made several = additions to it for use within Linux (or Unix?). I don't know all the = details, so maybe someone with a bit more knowledge can fill in the = gaps, but it is well worth considering if you are on the hunt for = perfect ANSI compliant C++. Another point is that the developers of Dev-C++ and the developers MinGW = cannot be responsible when the compiler doesn't work in exactly the way = you expect. On the brightside, you are getting a free, open-source, = cross-platform and non-proprietory compiler. The source for the latest GCC versions is freely available, but AFAIK no = one has yet managed to produce a successful port of it to the windows = environment. You are welcome to try. Jason. |
|
From: Bob W. <bo...@ph...> - 2002-04-19 21:57:34
|
David,
An array is not dynamic, the value you pass it at initalization must =
be a constat of some sort.if 'i' were to change during the program some =
weird voodoo (the program will crash,the world will end,etc.) all this =
will hapen because it cannot change the size of an array at =
runtime(reason no. 1 linked lists were created)
I am in the process of learning C++, as Ioannis well knows, and a week =
or so ago I was working on the array chapter. In the past I have done =
most of my programming in pascal, and every pascal compiler I have used =
will not compile an array if the size of the array is a variable, i.e., =
no dynamic arrays. Just fooling around I modified the simple little C++ =
array program to define an array with a variable. I had not done any =
research but was confident that the compiler would flag an error and =
bail out.=20
Not So! the program compiled and ran allowing me to change the size of =
the array. I tested the bounds of the program and could build quite =
large arrays. the size_of function always returnd the correct size of =
the array. I was really surprised because that it worked. I have not =
employed the technique in any real world program, because I felt that it =
would be much safer with pointers and linked lists.=20
Your message above confirmed what I suspected but had not taken the time =
to investigate. Stroustrup says:
The number of elements of the array, the array bound, must be a =
constant expresseion (=A7C.5)
Paragraph C.5 says in part:
A constant expression evaluates to an integral of enumeration =
constant. Such an expression is composed of literals, enumerators, and =
const initialized by constant expressions. < . . . > Intuitively, =
constant expressions are simple expressions that can be evaluated by the =
compiler before the program is linked and starts to run.
That tells me that the compiler should have caught this and bailed out =
rather than compiling, linking, and running this program:=20
#include <iostream.h>
#include <stdlib.h>
int main
{
int arraySize =3D 1;
std::cout << "Enter the size of the array: ";
std::cin >> arraySize;
if (!(arraySize > 0))
{
system("pause");
return 0;
}
int myArray[arraySize];
int arrayLength =3D sizeof(myArray)/sizeof(myArray[0]);
for (int i=3D0; i < arrayLength; i++) // 0 to arrayLength-1
{
myArray[i] =3D (i + 1) * 2 + 1;
}
for (int i=3D0; i< arrayLength; i++) // 0 to arrayLength-1
{
std::cout << i << ": " << myArray[i] << "\n";
}
=20
system("pause");
return 0;
}
The faulty compiler is the one used by Bloodshed. Visual C++ 6.0 caught =
the error. That is the second and most serious problem I have found with =
the compiler used by the dev-c++ environment. It appears it will =
properly compile ANSI standard code, but it will also compile code that =
is clearly outside of the standard.=20
I believe that the dev-c++ compiler is the mingw compiler.=20
Regards,
Bob Wilson
|
|
From: Christiaan S. <ck...@ia...> - 2002-04-19 21:01:46
|
hi everything worked fine till i installed winxp. Now the programs i = compile run with dev c++ run in software rendering! I know its not my = card because the previously compiled versions run fine. I think i just = need to put the opengl dll file somewhere new but i dont know where? P.S. does this list allow binary posting? |
|
From: Ioannis V. <no...@ho...> - 2002-04-19 17:32:24
|
-----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Peter Lelkes Sent: Friday, April 19, 2002 2:27 PM To: dev...@li... Subject: [Dev-C++] (no subject) Hi. I'm using Dev-C++ 4 on win 98SE When I use the Insert button from the special tool bar for #include, the command shows like: #include "LIB.H" My questions are: 1) is there any way getting it in the right way from the beginning, i.e.: #include <LIB.H>? You can type it yourself. That's what i do. 2) or will #include "LIB.H" compile correctly in C? It will, but if the header file is placed in the default compiler header file directory better use the <> notion. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.cjb.net <http://www.noicys.cjb.net/> * Alternative URL: http://run.to/noicys |
|
From: Lorenzo <co...@in...> - 2002-04-19 14:13:21
|
I don't know your specific problem, but try this hint 1. add "END_OF_MAIN();" at end of your code 2. add -mwindows to g++ option I have downloaded the allegro source and build the library, if have any problem i can send it to you (lib, def, dll and include) p.s. I am not an expert of allegro, i have made only some test. ---------------------------------------------------------------------------- --- If debugging is the process of removing bugs, then programming must be the process of putting them in. ---------------------------------------------------------------------------- --- |
|
From: <Fra...@ao...> - 2002-04-19 14:00:17
|
Dans un e-mail dat=E9 du 19/04/2002 15:17:57 Paris, Madrid (heure d'=E9t=E9)=
,=20
mu...@gm... a =E9crit :
> /* Allegro test */
>=20
> #include <allegro.h>
> #include <winalleg.h>
> #include <windows.h>
>=20
> int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
> {
> allegro_init();
>=20
> if(os_type =3D=3D OSTYPE_WINXP)
> {
> MessageBox(NULL, "XP has been detected.", "WinXP", MB_OK);
> }
> else
> {
> MessageBox(NULL, "XP was not detected.", "Error!", MB_OK |=20
> MB_ICONHAND);
> return 1;
> }
>=20
> // Do stuff here
>=20
> return 0;
> }=20
>=20
>=20
Choose Allegro Project(Static Linked) when you create your project.
Delete all the code and paste yours. All is fine for me with Dev-c++ 4.1 and=
=20
Windows XP familial edition. After compilation, i've got an executable of 33=
3=20
Ko.
|
|
From: David M. <ci...@ya...> - 2002-04-19 13:43:59
|
Sorry for the double post I thought I only sent the reply to 1 person and re-sent it to the mailing list I apoligise __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ |
|
From: David M. <ci...@ya...> - 2002-04-19 13:38:12
|
Define the varible in one of your sourc files
and in the others put
extern {var type} {var name};
this should resolve your linker problems
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
|
|
From: David M. <ci...@ya...> - 2002-04-19 13:30:32
|
An array is not dynamic. It must me initalized using a constant not a varible. Bad things can happen if the value of 'i' changes while the program is running there is nothing defined in the ANSI standard to remedy that It comes down to your compiler. If it has code to correct this problem then you have no problems. Otherwise expect a BOOM! __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ |
|
From: David M. <ci...@ya...> - 2002-04-19 13:24:27
|
An array is not dynamic, the value you pass it at
initalization must be a constat of some sort.
if 'i' were to change during the program some weird
voodoo (the program will crash,the world will end,etc.)
all this will hapen because it cannot change the size of an
array at runtime(reason no. 1 linked lists were created)
> >From: "Anon" <an...@pu...>
> >To: <dev...@li...>
> >Subject: [Dev-C++] Ansi compatible?
> >Date: Thu, 18 Apr 2002 11:50:11 +0530
> >
> >Hey!
> >Can anyone please tell me if the following code is ANSI
> compatible? It
> >compiles fine with DevC++ but throws up an error in Borland 5.0
> >
> >#include <iostream.h>
> >#include <stdlib.h>
> >
> >int main()
> >{
> > int i=10;
> > int arr[i]; //can it do accept Integer variable
> > system("PAUSE");
> > return 0;
> >}
> >
> >My classmates say that this is a violation of ANSI standard.
> >
> >
> >---
> >Outgoing mail is certified Virus Free.
> >Checked by AVG anti-virus system (http://www.grisoft.com).
> >Version: 6.0.346 / Virus Database: 194 - Release Date: 4/10/2002
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger:
> http://messenger.msn.com
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
|
|
From: Abhijit S. <mu...@gm...> - 2002-04-19 13:15:26
|
I downloaded Allegro for Dev-C++ from the Bloodshed site, and extracted =
it to the Dev-C++ folder. I tried to compile a simple project using =
Allegro, after adding '-lalleg' to the command-line box, but on the =
first try, it does not link and gives this message:
g++: -lalleg: linker input file unused since linking not done
However, when I press Ctrl+F9 again, it links, and a 6 kb EXE is =
produced. When I try to run it, it gives me a message saying =
'alleg40.dll not found'. I searched for this file and it was nowhere to =
be found. Also, there are a few EXEs in the Allegro directory, which =
seem to run fine without the DLL... these files are hundreds of KBs =
larger than the one I was able to produce. I also tried linking in the =
'liballeg_s' library, which I found in the 'lib/' sub-directory. It =
didn't help, the EXE size is still 6 kb. The manual says that compile =
instructions are included in 'readme.txt', which doesn't exist. I'm =
running on XP professional. The source code:
-------------------------------------------------------------------------=
-------
/* Allegro test */
#include <allegro.h>
#include <winalleg.h>
#include <windows.h>
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
allegro_init();
if(os_type =3D=3D OSTYPE_WINXP)
{
MessageBox(NULL, "XP has been detected.", "WinXP", MB_OK);
}
else
{
MessageBox(NULL, "XP was not detected.", "Error!", MB_OK | =
MB_ICONHAND);
return 1;
}
// Do stuff here
return 0;
}
-------------------------------------------------------------------------=
-------
Whattodo?
mdeth O
m.o.t.o[P.S.Y.C.H.O]=20
http://mudeth.tripod.com | ibr...@bi... | mu...@gm...
|
|
From: Peter L. <pl...@ya...> - 2002-04-19 11:27:28
|
Hi.
I'm using Dev-C++ 4 on win 98SE
When I use the Insert button from the special tool bar for #include, the
command shows like:
#include "LIB.H"
My questions are:
1) is there any way getting it in the right way from the beginning, i.e.:
#include <LIB.H>?
2) or will #include "LIB.H" compile correctly in C?
Any help will be appreciated
Peter Lelkes
CRNA & ICU-nurse
Self-thought computer nerd
Stockholm, Sweden, Europe
|
|
From: Daniel G. <sp...@ho...> - 2002-04-19 10:29:15
|
Thanks, I'll check those links later. That cleared that up, cheers. Thanks to everyone who's been helping me out, Daniel >From: Jason Silverman <mys...@op...> >To: dev...@li... >Subject: Re: [Dev-C++] scope resolution +1 >Date: Fri, 19 Apr 2002 04:21:21 -0400 > >It's an initalizer list. A short summary of them can be found here, >http://pstonge.stmarys.medford.or.us/adv_cpp_1/lectures/advanced_functions2. >htm, and here, http://oakroadsystems.com/codeprac/inher.htm. They're >short, >but to the point. Basically it's initalizing a data member to a value as >it's created, instead of normal constructors which do so afterwards. > >Jason >----- Original Message ----- >From: "Daniel Glenfield" <sp...@ho...> >To: <dev...@li...> >Sent: Friday, April 19, 2002 4:01 AM >Subject: [Dev-C++] scope resolution +1 > > > > What does it mean when you have the scope resolution operator and the >single > > : in the same bit of code? > > > > e.g. > > > > CDialog1::CDialog1(CWnd* pParent /*=NULL*/) > > : CDialog(CDialog1::IDD, pParent) > > > > ? > > >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >https://lists.sourceforge.net/lists/listinfo/dev-cpp-users _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. |