dev-cpp-users Mailing List for Dev-C++
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
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
|
2
|
3
(1) |
4
|
5
|
6
|
7
|
8
(1) |
9
(1) |
10
|
11
|
12
|
13
|
14
|
15
|
16
|
17
(3) |
18
(2) |
19
|
20
(5) |
21
(3) |
22
|
23
(1) |
24
(1) |
25
|
26
|
27
|
28
|
29
|
30
|
|
|
|
|
|
|
From: Brad <nyc...@gm...> - 2012-09-24 11:44:29
|
it does not give me a line number but I am really sure the issue is from my vector usage (vector n00b). If I remove line 47 from this code -> <http://pastie.org/4790174> http://pastie.org/4790174 the problem goes away (I also lose 90% of my functions). The only thing that changed is that on line 96 (setValuesfromffmpeg) the populating of the vector data in that function, used to be an array and the vector is being declared now in the .h (so that it can be reached by my .h, so it is there for a reason) here line 9 -> <http://pastie.org/4790176> http://pastie.org/4790176 complete error -> <http://pastie.org/4790168> http://pastie.org/4790168 Brad |
From: Brad <nyc...@gm...> - 2012-09-23 02:51:02
|
In this psuedo code, what would block line 25 from accessing line 32? http://pastie.org/4783374 line 18, 22 and 25, laArray is undefined even though it is plenty defined in main() form1 <http://pastie.org/4783166> http://pastie.org/4783166 main() <http://pastie.org/4783187> http://pastie.org/4783187 error: <http://pastie.org/4783179> http://pastie.org/4783179 Why can't I access laArray in main() from form1? Brad |
From: Robert A. <ral...@gm...> - 2012-09-21 10:30:57
|
Hello, It's undefined in the standard.... the sub expressions can be calculated in any order.... ie... = a++ + b++ + a + b; a++ could be calculated before or after any of the following b++ , a , b, Since the side effects of the a++ and b++ change the value of the later it is undefined in C or C++ See also: http://en.wikipedia.org/wiki/Unspecified_behavior On Thu, Sep 20, 2012 at 9:50 PM, Reid Thompson <rei...@at...> wrote: > On 9/20/2012 9:08 PM, Mani wrote: >> I think I might argue with one point way below.. please scroll down.. >> >> On Thu, Sep 20, 2012 at 4:08 PM, Reid Thompson <Rei...@at...> wrote: >>> On Thu, 2012-09-20 at 12:54 -0400, Mani wrote: >>>> Hi, >>>> >>>> I recently to try some toy things in DevC++ (version I am using is 4.9.9.2) >>>> >>>> The code I had was this: >>>> >>>> int a = 1, b = 2; >>>> int c = a++ + b++ + a + b; >>>> >>>> cout << "a = " << a << endl; >>>> cout << "b = " << b << endl; >>>> cout << "c = " << c << endl; >>>> >>>> I expected the c value to be 8 (by operator precedence, ++ has higher >>>> precedence than +, so do in order: >>>> a++, then b++ >>>> then do (a++ + b++) >>>> then add the previous result and a >>>> then add the previous result and b >>>> >>>> but the answer I got was 6.. >>>> >>>> what might be the reason for this..?? >>>> >>>> thanks, murali >>>> >>>> ------------------------------------------------------------------------------ >>>> Everyone hates slow websites. So do we. >>>> Make your web apps faster with AppDynamics >>>> Download AppDynamics Lite for free today: >>>> http://ad.doubleclick.net/clk;258768047;13503038;j? >>>> http://info.appdynamics.com/FreeJavaPerformanceDownload.html >>>> _______________________________________________ >>>> Dev-cpp-users mailing list >>>> Dev...@li... >>>> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >>>> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >>> [16:06:54][94s] rthompso@raker2> ~ >>> $ cat helloworld.c >>> #include <stdio.h> >>> #include <stdlib.h> >>> int main(void) >>> { >>> int a = 1, b = 2; >>> int c = a++ + b++ + a + b; >>> >>> printf("c is %d\n", c); >>> a = 1; >>> b = 2; >>> c = ++a + ++b + a + b; >>> >>> printf("c is %d\n", c); >>> >>> return 0; >>> >>> } >>> >>> [16:07:01][0s] rthompso@raker2> ~ >>> $ cat Hello.cs >>> using System; >>> >>> class Program >>> { >>> static void Main() >>> { >>> int a = 1, b = 2; >>> int c = a++ + b++ + a + b; >>> >>> Console.WriteLine(c); >>> Console.WriteLine("Hello world!"); >>> >>> a = 1; >>> b = 2; >>> c = ++a + ++b + a + b; >>> Console.WriteLine(c); >>> Console.WriteLine("Hello world!"); >>> >>> >>> a = 1; >>> b = 2; >>> c = a++ + b++; >>> int d = c + a + b; >>> >>> Console.WriteLine(d); >>> } >>> } >>> >>> [16:07:26][0s] rthompso@raker2> ~ >>> $ ./a.out >>> c is 6 >>> c is 10 >>> >>> [16:07:30][0s] rthompso@raker2> ~ >>> $ mono Hello.exe >>> 8 >>> Hello world! >>> 10 >>> Hello world! >>> 8 >>> >>> >>> gcc C >>> n++ -> increment after use >>>> int a = 1, b = 2; >>>> int c = a++ + b++ + a + b; >>> c = 1 + 2 + 1 + 2 >>> c = 6 >>> >>> ++n -> increment before use >>>> int a = 1, b = 2; >>>> int c = ++a + ++b + a + b; >>> c = 2 + 3 + 2 + 3 >>> c = 10 >>> >>> mcs csharp >>> evidently creates an incremented copy and uses it with the original >>> value >>>> int a = 1, b = 2; >>>> int c = a++ + b++ + a + b; >>> c = 2 + 3 + 1 + 2 >>> c = 8 >>>>>> BEGIN: Murali: >> How can you be sure that this is what happens.. I am inclined to >> believe what happens is: >> c = 1 + 2 + 2 + 3 >> c = 8 >> >>>>>> END: Murali >>> ++n -> increment before use >>>> int a = 1, b = 2; >>>> int c = ++a + ++b + a + b; >>> c = 2 + 3 + 2 + 3 >>> c = 10 >>> >>> a = 1; >>> b = 2; >>> c = a++ + b++; >>> int d = c + a + b; >>> c = 5 >>> d = 5 + 1 + 2 >>> d = 8 >>> >>> > ok -- you are most likely correct. > > ------------------------------------------------------------------------------ > Got visibility? > Most devs has no idea what their production app looks like. > Find out how fast your code is with AppDynamics Lite. > http://ad.doubleclick.net/clk;262219671;13503038;y? > http://info.appdynamics.com/FreeJavaPerformanceDownload.html > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Reid T. <rei...@at...> - 2012-09-21 01:51:00
|
On 9/20/2012 9:08 PM, Mani wrote: > I think I might argue with one point way below.. please scroll down.. > > On Thu, Sep 20, 2012 at 4:08 PM, Reid Thompson <Rei...@at...> wrote: >> On Thu, 2012-09-20 at 12:54 -0400, Mani wrote: >>> Hi, >>> >>> I recently to try some toy things in DevC++ (version I am using is 4.9.9.2) >>> >>> The code I had was this: >>> >>> int a = 1, b = 2; >>> int c = a++ + b++ + a + b; >>> >>> cout << "a = " << a << endl; >>> cout << "b = " << b << endl; >>> cout << "c = " << c << endl; >>> >>> I expected the c value to be 8 (by operator precedence, ++ has higher >>> precedence than +, so do in order: >>> a++, then b++ >>> then do (a++ + b++) >>> then add the previous result and a >>> then add the previous result and b >>> >>> but the answer I got was 6.. >>> >>> what might be the reason for this..?? >>> >>> thanks, murali >>> >>> ------------------------------------------------------------------------------ >>> Everyone hates slow websites. So do we. >>> Make your web apps faster with AppDynamics >>> Download AppDynamics Lite for free today: >>> http://ad.doubleclick.net/clk;258768047;13503038;j? >>> http://info.appdynamics.com/FreeJavaPerformanceDownload.html >>> _______________________________________________ >>> Dev-cpp-users mailing list >>> Dev...@li... >>> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >>> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> [16:06:54][94s] rthompso@raker2> ~ >> $ cat helloworld.c >> #include <stdio.h> >> #include <stdlib.h> >> int main(void) >> { >> int a = 1, b = 2; >> int c = a++ + b++ + a + b; >> >> printf("c is %d\n", c); >> a = 1; >> b = 2; >> c = ++a + ++b + a + b; >> >> printf("c is %d\n", c); >> >> return 0; >> >> } >> >> [16:07:01][0s] rthompso@raker2> ~ >> $ cat Hello.cs >> using System; >> >> class Program >> { >> static void Main() >> { >> int a = 1, b = 2; >> int c = a++ + b++ + a + b; >> >> Console.WriteLine(c); >> Console.WriteLine("Hello world!"); >> >> a = 1; >> b = 2; >> c = ++a + ++b + a + b; >> Console.WriteLine(c); >> Console.WriteLine("Hello world!"); >> >> >> a = 1; >> b = 2; >> c = a++ + b++; >> int d = c + a + b; >> >> Console.WriteLine(d); >> } >> } >> >> [16:07:26][0s] rthompso@raker2> ~ >> $ ./a.out >> c is 6 >> c is 10 >> >> [16:07:30][0s] rthompso@raker2> ~ >> $ mono Hello.exe >> 8 >> Hello world! >> 10 >> Hello world! >> 8 >> >> >> gcc C >> n++ -> increment after use >>> int a = 1, b = 2; >>> int c = a++ + b++ + a + b; >> c = 1 + 2 + 1 + 2 >> c = 6 >> >> ++n -> increment before use >>> int a = 1, b = 2; >>> int c = ++a + ++b + a + b; >> c = 2 + 3 + 2 + 3 >> c = 10 >> >> mcs csharp >> evidently creates an incremented copy and uses it with the original >> value >>> int a = 1, b = 2; >>> int c = a++ + b++ + a + b; >> c = 2 + 3 + 1 + 2 >> c = 8 >>>>> BEGIN: Murali: > How can you be sure that this is what happens.. I am inclined to > believe what happens is: > c = 1 + 2 + 2 + 3 > c = 8 > >>>>> END: Murali >> ++n -> increment before use >>> int a = 1, b = 2; >>> int c = ++a + ++b + a + b; >> c = 2 + 3 + 2 + 3 >> c = 10 >> >> a = 1; >> b = 2; >> c = a++ + b++; >> int d = c + a + b; >> c = 5 >> d = 5 + 1 + 2 >> d = 8 >> >> ok -- you are most likely correct. |
From: Mani <man...@gm...> - 2012-09-21 01:08:30
|
I think I might argue with one point way below.. please scroll down.. On Thu, Sep 20, 2012 at 4:08 PM, Reid Thompson <Rei...@at...> wrote: > On Thu, 2012-09-20 at 12:54 -0400, Mani wrote: >> Hi, >> >> I recently to try some toy things in DevC++ (version I am using is 4.9.9.2) >> >> The code I had was this: >> >> int a = 1, b = 2; >> int c = a++ + b++ + a + b; >> >> cout << "a = " << a << endl; >> cout << "b = " << b << endl; >> cout << "c = " << c << endl; >> >> I expected the c value to be 8 (by operator precedence, ++ has higher >> precedence than +, so do in order: >> a++, then b++ >> then do (a++ + b++) >> then add the previous result and a >> then add the previous result and b >> >> but the answer I got was 6.. >> >> what might be the reason for this..?? >> >> thanks, murali >> >> ------------------------------------------------------------------------------ >> Everyone hates slow websites. So do we. >> Make your web apps faster with AppDynamics >> Download AppDynamics Lite for free today: >> http://ad.doubleclick.net/clk;258768047;13503038;j? >> http://info.appdynamics.com/FreeJavaPerformanceDownload.html >> _______________________________________________ >> Dev-cpp-users mailing list >> Dev...@li... >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > [16:06:54][94s] rthompso@raker2> ~ > $ cat helloworld.c > #include <stdio.h> > #include <stdlib.h> > int main(void) > { > int a = 1, b = 2; > int c = a++ + b++ + a + b; > > printf("c is %d\n", c); > a = 1; > b = 2; > c = ++a + ++b + a + b; > > printf("c is %d\n", c); > > return 0; > > } > > [16:07:01][0s] rthompso@raker2> ~ > $ cat Hello.cs > using System; > > class Program > { > static void Main() > { > int a = 1, b = 2; > int c = a++ + b++ + a + b; > > Console.WriteLine(c); > Console.WriteLine("Hello world!"); > > a = 1; > b = 2; > c = ++a + ++b + a + b; > Console.WriteLine(c); > Console.WriteLine("Hello world!"); > > > a = 1; > b = 2; > c = a++ + b++; > int d = c + a + b; > > Console.WriteLine(d); > } > } > > [16:07:26][0s] rthompso@raker2> ~ > $ ./a.out > c is 6 > c is 10 > > [16:07:30][0s] rthompso@raker2> ~ > $ mono Hello.exe > 8 > Hello world! > 10 > Hello world! > 8 > > > gcc C > n++ -> increment after use >> int a = 1, b = 2; >> int c = a++ + b++ + a + b; > c = 1 + 2 + 1 + 2 > c = 6 > > ++n -> increment before use >> int a = 1, b = 2; >> int c = ++a + ++b + a + b; > c = 2 + 3 + 2 + 3 > c = 10 > > mcs csharp > evidently creates an incremented copy and uses it with the original > value >> int a = 1, b = 2; >> int c = a++ + b++ + a + b; > c = 2 + 3 + 1 + 2 > c = 8 >>>> BEGIN: Murali: How can you be sure that this is what happens.. I am inclined to believe what happens is: c = 1 + 2 + 2 + 3 c = 8 >>>> END: Murali > > ++n -> increment before use >> int a = 1, b = 2; >> int c = ++a + ++b + a + b; > c = 2 + 3 + 2 + 3 > c = 10 > > a = 1; > b = 2; > c = a++ + b++; > int d = c + a + b; > c = 5 > d = 5 + 1 + 2 > d = 8 > > |
From: Reid T. <Rei...@at...> - 2012-09-20 20:25:08
|
On Thu, 2012-09-20 at 12:54 -0400, Mani wrote: > Hi, > > I recently to try some toy things in DevC++ (version I am using is 4.9.9.2) > > The code I had was this: > > int a = 1, b = 2; > int c = a++ + b++ + a + b; > > cout << "a = " << a << endl; > cout << "b = " << b << endl; > cout << "c = " << c << endl; > > I expected the c value to be 8 (by operator precedence, ++ has higher > precedence than +, so do in order: > a++, then b++ > then do (a++ + b++) > then add the previous result and a > then add the previous result and b > > but the answer I got was 6.. > > what might be the reason for this..?? > > thanks, murali > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://ad.doubleclick.net/clk;258768047;13503038;j? > http://info.appdynamics.com/FreeJavaPerformanceDownload.html > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users [16:06:54][94s] rthompso@raker2> ~ $ cat helloworld.c #include <stdio.h> #include <stdlib.h> int main(void) { int a = 1, b = 2; int c = a++ + b++ + a + b; printf("c is %d\n", c); a = 1; b = 2; c = ++a + ++b + a + b; printf("c is %d\n", c); return 0; } [16:07:01][0s] rthompso@raker2> ~ $ cat Hello.cs using System; class Program { static void Main() { int a = 1, b = 2; int c = a++ + b++ + a + b; Console.WriteLine(c); Console.WriteLine("Hello world!"); a = 1; b = 2; c = ++a + ++b + a + b; Console.WriteLine(c); Console.WriteLine("Hello world!"); a = 1; b = 2; c = a++ + b++; int d = c + a + b; Console.WriteLine(d); } } [16:07:26][0s] rthompso@raker2> ~ $ ./a.out c is 6 c is 10 [16:07:30][0s] rthompso@raker2> ~ $ mono Hello.exe 8 Hello world! 10 Hello world! 8 gcc C n++ -> increment after use > int a = 1, b = 2; > int c = a++ + b++ + a + b; c = 1 + 2 + 1 + 2 c = 6 ++n -> increment before use > int a = 1, b = 2; > int c = ++a + ++b + a + b; c = 2 + 3 + 2 + 3 c = 10 mcs csharp evidently creates an incremented copy and uses it with the original value > int a = 1, b = 2; > int c = a++ + b++ + a + b; c = 2 + 3 + 1 + 2 c = 8 ++n -> increment before use > int a = 1, b = 2; > int c = ++a + ++b + a + b; c = 2 + 3 + 2 + 3 c = 10 a = 1; b = 2; c = a++ + b++; int d = c + a + b; c = 5 d = 5 + 1 + 2 d = 8 |
From: Mani <man...@gm...> - 2012-09-20 18:21:37
|
Thanks for all the comments.. I had posted to mingw-users mailing list as well, I had lots of good responses there (I had posted here w/o looking at those responses..) for those interested, you can see these at: http://sourceforge.net/mailarchive/forum.php?thread_name=5058E683.1010205%40users.sourceforge.net&forum_name=mingw-users thanks once again for your time. best, murali. On Thu, Sep 20, 2012 at 2:15 PM, Brothers, Robert <rob...@tq...> wrote: > Murali, > > I'm not a C++ programmer (use C# mostly), but I put your original code > into Visual Studio C++.net and it gave the c = 6 result as well. > > The code Mani offered ( ++a + ++b + a + b) gave the value of 10 (which I > tend to feel is understandable since the value of a and b are > incremented first then 2 + 3 + 2 + 3 = 10). > > If I write the code as: > > int a = 1, b = 2; > int c = a++ + b++; > c += a + b; > > I DO get 8 as the result. > > Also, in C#, your original code give 8 as you found in Java. > > As I said, I'm not a C++ programmer (I'm a EE not a programmer;^) > > Regards > Bob > > > > -----Original Message----- > From: Mani [mailto:man...@gm...] > Sent: Thursday, September 20, 2012 1:09 PM > To: a.geo > Cc: dev...@li... > Subject: Re: [Dev-C++] Question about increment.. > > Hi, > > But this is not right, if I understand precedence rules correctly.. > ++ has higher precedence than addition.. your explanation seems to say > that ++ is done after addition.. > > In Java, the same expression gives 8.., and I believe other C++ > compilers also gave 8 (I heard from others; I have not tested this > myself -- I did test what happens in Java myself). > > I am inclined to think this looks like a bug..?? > > thanks, murali. > > On Thu, Sep 20, 2012 at 1:04 PM, a.geo <aqu...@gm...> wrote: >> Well, you really are doing the next >> >> int a = 1, b = 2; >> int c = a + b + a + b; >> a++; >> b++; >> This is why you get 6, remember the ++ is a prefix in this case, then, > is >> executed NEXT to the expression. >> >> >> int c = ++a + ++b + a + b; >> Well, if this compile correctly, give you the 8 value, because >> >> int a = 1, b = 2; >> ++a; >> ++b; >> int c = a + b + a + b; >> >> 2012/9/20 Mani <man...@gm...> >>> >>> Hi, >>> >>> I recently to try some toy things in DevC++ (version I am using is >>> 4.9.9.2) >>> >>> The code I had was this: >>> >>> int a = 1, b = 2; >>> int c = a++ + b++ + a + b; >>> >>> cout << "a = " << a << endl; >>> cout << "b = " << b << endl; >>> cout << "c = " << c << endl; >>> >>> I expected the c value to be 8 (by operator precedence, ++ has higher >>> precedence than +, so do in order: >>> a++, then b++ >>> then do (a++ + b++) >>> then add the previous result and a >>> then add the previous result and b >>> >>> but the answer I got was 6.. >>> >>> what might be the reason for this..?? >>> >>> thanks, murali >>> > > ------------------------------------------------------------------------ > ------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://ad.doubleclick.net/clk;258768047;13503038;j? > http://info.appdynamics.com/FreeJavaPerformanceDownload.html > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > |
From: Mani <man...@gm...> - 2012-09-20 18:08:52
|
Hi, But this is not right, if I understand precedence rules correctly.. ++ has higher precedence than addition.. your explanation seems to say that ++ is done after addition.. In Java, the same expression gives 8.., and I believe other C++ compilers also gave 8 (I heard from others; I have not tested this myself -- I did test what happens in Java myself). I am inclined to think this looks like a bug..?? thanks, murali. On Thu, Sep 20, 2012 at 1:04 PM, a.geo <aqu...@gm...> wrote: > Well, you really are doing the next > > int a = 1, b = 2; > int c = a + b + a + b; > a++; > b++; > This is why you get 6, remember the ++ is a prefix in this case, then, is > executed NEXT to the expression. > > > int c = ++a + ++b + a + b; > Well, if this compile correctly, give you the 8 value, because > > int a = 1, b = 2; > ++a; > ++b; > int c = a + b + a + b; > > 2012/9/20 Mani <man...@gm...> >> >> Hi, >> >> I recently to try some toy things in DevC++ (version I am using is >> 4.9.9.2) >> >> The code I had was this: >> >> int a = 1, b = 2; >> int c = a++ + b++ + a + b; >> >> cout << "a = " << a << endl; >> cout << "b = " << b << endl; >> cout << "c = " << c << endl; >> >> I expected the c value to be 8 (by operator precedence, ++ has higher >> precedence than +, so do in order: >> a++, then b++ >> then do (a++ + b++) >> then add the previous result and a >> then add the previous result and b >> >> but the answer I got was 6.. >> >> what might be the reason for this..?? >> >> thanks, murali >> |
From: a.geo <aqu...@gm...> - 2012-09-20 17:06:49
|
Change prefix by postfix... : D 2012/9/20 a.geo <aqu...@gm...> > Well, you really are doing the next > > int a = 1, b = 2; > int c = a + b + a + b; > a++; > b++; > This is why you get 6, remember the ++ is a prefix in this case, then, is > executed NEXT to the expression. > > int c = ++a + ++b + a + b; > Well, if this compile correctly, give you the 8 value, because > > int a = 1, b = 2; > ++a; > ++b; > int c = a + b + a + b; > > > 2012/9/20 Mani <man...@gm...> > >> Hi, >> >> I recently to try some toy things in DevC++ (version I am using is >> 4.9.9.2) >> >> The code I had was this: >> >> int a = 1, b = 2; >> int c = a++ + b++ + a + b; >> >> cout << "a = " << a << endl; >> cout << "b = " << b << endl; >> cout << "c = " << c << endl; >> >> I expected the c value to be 8 (by operator precedence, ++ has higher >> precedence than +, so do in order: >> a++, then b++ >> then do (a++ + b++) >> then add the previous result and a >> then add the previous result and b >> >> but the answer I got was 6.. >> >> what might be the reason for this..?? >> >> thanks, murali >> >> >> ------------------------------------------------------------------------------ >> Everyone hates slow websites. So do we. >> Make your web apps faster with AppDynamics >> Download AppDynamics Lite for free today: >> http://ad.doubleclick.net/clk;258768047;13503038;j? >> http://info.appdynamics.com/FreeJavaPerformanceDownload.html >> _______________________________________________ >> Dev-cpp-users mailing list >> Dev...@li... >> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm >> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >> > > > > -- > Cesar De la Cruz Rojas > > *La mision de un buen soldado, no es morir por su patria, sino, lograr > que el soldado enemigo muera por la suya...* > * > ----------------------------------------------------------------------------- > * > Sennior Software Engineer > > ----------------------------------------------------------------------------- > Follow me in Facebook : http://www.facebook.com/aquiles.geo > Twitter http://twitter.com/ageo > Picture blog http://ageo.deviantart.com > > -- Cesar De la Cruz Rojas *La mision de un buen soldado, no es morir por su patria, sino, lograr que el soldado enemigo muera por la suya...* * ----------------------------------------------------------------------------- * Sennior Software Engineer ----------------------------------------------------------------------------- Follow me in Facebook : http://www.facebook.com/aquiles.geo Twitter http://twitter.com/ageo Picture blog http://ageo.deviantart.com |
From: Mani <man...@gm...> - 2012-09-20 16:54:29
|
Hi, I recently to try some toy things in DevC++ (version I am using is 4.9.9.2) The code I had was this: int a = 1, b = 2; int c = a++ + b++ + a + b; cout << "a = " << a << endl; cout << "b = " << b << endl; cout << "c = " << c << endl; I expected the c value to be 8 (by operator precedence, ++ has higher precedence than +, so do in order: a++, then b++ then do (a++ + b++) then add the previous result and a then add the previous result and b but the answer I got was 6.. what might be the reason for this..?? thanks, murali |
From: Dennis G R. <den...@co...> - 2012-09-18 15:52:29
|
From: Brad <nyc...@gm...> - 2012-09-18 01:45:34
|
My data is almost in its function but I am having difficulties with the final step. Goal: To get the array data into a textbox window on line 406 and 407 of -> http://pastie.org/4742333 But I am getting this error http://pastie.org/4742347 and I have tried a few different versions of passing the argument but no success. Brad From: bibigiu [mailto:bi...@al...] Sent: Monday, September 17, 2012 11:30 AM To: Brad Subject: Re: [Dev-C++] how to pass a string array to another function Il 17/09/2012 14:40, Brad ha scritto: That's the problem, my function is not in main() and this is where the errors get weird is when I pass the same arguments in a function outside of main. Brad From: bibigiu [mailto:bi...@al...] Sent: Monday, September 17, 2012 8:04 AM To: Brad Subject: Re: [Dev-C++] how to pass a string array to another function Il 17/09/2012 13:40, Brad ha scritto: My situation is this, I have a string array that I am trying to get the data to another function but have issues with the return type conflicting with either the function definition or the array data being passed. std::array Array[2] std::string f() { array[0]=ted array[1]=bundy return Array[2]; }}; void printarray (int arg[], int length) { for (int n=0; n<length; n++) cout << Array[n] << endl; } int main () { printarray(); return 0; } try this : #include <iostream> using namespace std; void PrintArray(std::string str[],int length) { for(int a=0;a<length;a++) { cout<< str[a].c_str() << endl; } } int main() { std::string str[2]; str[0] = "hello"; str[1] = "bye"; PrintArray(str,2); return 0; } ---------------------------------------------------------------------------- -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ops... try this void PrintArray(std::string *str,int length) { for(int a=0;a<length;a++) { cout<< str[a].c_str() << endl; } } string* CreateStrArray(int size) { std::string *str = new std::string[size]; for(int a=0;a<size;a++) str[a] = "name"; return str; } int main( ) { std::string *str = CreateStrArray(2);// you must use pointer allocation with new(on the heap) for return object from a function... local variable created in the function are destroyed when return from the function!!!! PrintArray(str,2); return 0; } is that what you want? |
From: Brad <nyc...@gm...> - 2012-09-17 21:34:04
|
My data is almost in its function but I am having difficulties with the final step. Goal: To get the array data into a textbox window on line 406 and 407 of -> http://pastie.org/4742333 But I am getting this error http://pastie.org/4742347 and I have tried a few different versions of passing the argument but no success. The array data is generated by my case statements starting on line 79 on http://pastie.org/4742337 in my main() <following earlier recommendations> This last screw is giving me fits. :( Brad From: bibigiu [mailto:bi...@al...] Sent: Monday, September 17, 2012 8:04 AM To: Brad Subject: Re: [Dev-C++] how to pass a string array to another function Il 17/09/2012 13:40, Brad ha scritto: My situation is this, I have a string array that I am trying to get the data to another function but have issues with the return type conflicting with either the function definition or the array data being passed. std::array Array[2] std::string f() { array[0]=ted array[1]=bundy return Array[2]; }}; void printarray (int arg[], int length) { for (int n=0; n<length; n++) cout << Array[n] << endl; } int main () { printarray(); return 0; } try this : #include <iostream> using namespace std; void PrintArray(std::string str[],int length) { for(int a=0;a<length;a++) { cout<< str[a].c_str() << endl; } } int main() { std::string str[2]; str[0] = "hello"; str[1] = "bye"; PrintArray(str,2); return 0; } ---------------------------------------------------------------------------- -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Brad <nyc...@gm...> - 2012-09-17 12:40:48
|
That's the problem, my function is not in main() and this is where the errors get weird is when I pass the same arguments in a function outside of main. Brad From: bibigiu [mailto:bi...@al...] Sent: Monday, September 17, 2012 8:04 AM To: Brad Subject: Re: [Dev-C++] how to pass a string array to another function Il 17/09/2012 13:40, Brad ha scritto: My situation is this, I have a string array that I am trying to get the data to another function but have issues with the return type conflicting with either the function definition or the array data being passed. std::array Array[2] std::string f() { array[0]=ted array[1]=bundy return Array[2]; }}; void printarray (int arg[], int length) { for (int n=0; n<length; n++) cout << Array[n] << endl; } int main () { printarray(); return 0; } try this : #include <iostream> using namespace std; void PrintArray(std::string str[],int length) { for(int a=0;a<length;a++) { cout<< str[a].c_str() << endl; } } int main() { std::string str[2]; str[0] = "hello"; str[1] = "bye"; PrintArray(str,2); return 0; } ---------------------------------------------------------------------------- -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Brad <nyc...@gm...> - 2012-09-17 11:40:41
|
My situation is this, I have a string array that I am trying to get the data to another function but have issues with the return type conflicting with either the function definition or the array data being passed. std::array Array[2] std::string f() { array[0]=ted array[1]=bundy return Array[2]; }}; void printarray (int arg[], int length) { for (int n=0; n<length; n++) cout << Array[n] << endl; } int main () { printarray(); return 0; } Brad |
From: Nikhil R. <ruh...@gm...> - 2012-09-09 06:34:09
|
sir, i am having dev c++.but in that BGI folder is not there which is used to run graphics programming of " computer graphics "so plz help me to sort out this prob thank you. . |
From: Brad <nyc...@gm...> - 2012-09-08 22:24:51
|
I am trying to get a basic window to flash data into a basic textbox using winform c++/cli I am stuck in a maze between system::string and std::sting and all I am trying to do is display my first value in a textbox in a windows. -> http://pastie.org/4687404 Brad |
From: Nikhil R. <ruh...@gm...> - 2012-09-03 18:23:08
|
sir, I am not able to run my graphics program in dev c++ file version 4.9.9.2 . It is creating a problem as i have to submit a project. plz help me by sending latest version of dev c++ in which graphics program can run. thank you. |