Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #10929 > unrolled thread
| Started by | someone <newsboost@gmail.com> |
|---|---|
| First post | 2011-10-17 10:14 -0700 |
| Last post | 2011-10-19 09:30 -0700 |
| Articles | 8 on this page of 28 — 6 participants |
Back to article view | Back to comp.lang.c++
passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-17 10:14 -0700
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Victor Bazarov <v.bazarov@comcast.invalid> - 2011-10-17 13:43 -0400
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-17 11:23 -0700
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Victor Bazarov <v.bazarov@comcast.invalid> - 2011-10-17 15:22 -0400
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-17 12:40 -0700
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-10-19 14:08 +0000
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-19 09:23 -0700
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Paavo Helde <myfirstname@osa.pri.ee> - 2011-10-19 14:36 -0500
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-19 22:28 +0200
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-10-19 20:34 +0000
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-20 00:16 +0200
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Victor Bazarov <v.bazarov@comcast.invalid> - 2011-10-20 08:13 -0400
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-20 16:54 +0200
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-10-20 13:50 +0000
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-20 16:54 +0200
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-17 12:20 -0700
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Victor Bazarov <v.bazarov@comcast.invalid> - 2011-10-17 21:50 -0400
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-18 15:43 -0700
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Werner <werasm@gmail.com> - 2011-10-18 01:04 -0700
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Werner <werasm@gmail.com> - 2011-10-18 01:17 -0700
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-19 18:36 +0200
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Werner <werasm@gmail.com> - 2011-10-20 00:18 -0700
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-20 16:56 +0200
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... 88888 Dihedral <dihedral88888@googlemail.com> - 2011-10-24 03:12 -0700
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-10-24 20:17 +0000
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-18 16:35 -0700
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... Werner <werasm@gmail.com> - 2011-10-19 04:06 -0700
Re: passing array of floats (or vectors) into another function - data scope - hmmm. Very ugly... someone <newsboost@gmail.com> - 2011-10-19 09:30 -0700
Page 2 of 2 — ← Prev page 1 [2]
| From | someone <newsboost@gmail.com> |
|---|---|
| Date | 2011-10-19 18:36 +0200 |
| Message-ID | <4e9efc82$0$281$14726298@news.sunsite.dk> |
| In reply to | #10961 |
On 10/18/2011 10:17 AM, Werner wrote: >> library classes with my own placeholders. >> Note that no private > > "private" should be "global". Sorry! > > Code can be viewed here: > > http://ideone.com/mrePw By the way: How come you code on that webpage? Or I assume you made the program on your own pc and then copy/pasted it? I'm not familiar with that webpage, but I tried to clone the code and run it and modified it slightly... I prefer to code on my own pc, rather than to use a webbased online webcoding solution (or whatever it's called)... ? Not that I mind other people using it... Just wondering...
[toc] | [prev] | [next] | [standalone]
| From | Werner <werasm@gmail.com> |
|---|---|
| Date | 2011-10-20 00:18 -0700 |
| Message-ID | <76c03d67-2a0a-465d-b59b-59827a717983@y39g2000yqd.googlegroups.com> |
| In reply to | #10991 |
On Oct 19, 6:36 pm, someone <newsbo...@gmail.com> wrote: > > By the way: How come you code on that webpage? Or I assume you made the > program on your own pc and then copy/pasted it? perhaps OT... but - I don't need to create a project everytime. - I can use the latest compiler... - It's a nice way of sharing ideas. It's certainly a better way of looking at the code that using a newsreader. [You] can compile and run it immediately - The only disadvantage I see is that I don't know how persistent the code is (how long it will remain there). Of course when I do work I code on my PC/Notebook etc. Glad to be of help.
[toc] | [prev] | [next] | [standalone]
| From | someone <newsboost@gmail.com> |
|---|---|
| Date | 2011-10-20 16:56 +0200 |
| Message-ID | <4ea03698$0$294$14726298@news.sunsite.dk> |
| In reply to | #10998 |
On 2011-10-20 09:18, Werner wrote: > On Oct 19, 6:36 pm, someone<newsbo...@gmail.com> wrote: >> >> By the way: How come you code on that webpage? Or I assume you made the >> program on your own pc and then copy/pasted it? > > perhaps OT... but > > - I don't need to create a project everytime. > - I can use the latest compiler... > - It's a nice way of sharing ideas. It's certainly a > better way of looking at the code that using a > newsreader. [You] can compile and run it > immediately > - The only disadvantage I see is that I don't know > how persistent the code is (how long it will remain > there). > > Of course when I do work I code on my PC/Notebook etc. Ok, I see... I still prefer my own pc which compiles without "lagging" :-) > Glad to be of help. And a very good help, you were :-)
[toc] | [prev] | [next] | [standalone]
| From | 88888 Dihedral <dihedral88888@googlemail.com> |
|---|---|
| Date | 2011-10-24 03:12 -0700 |
| Message-ID | <30217469.1679.1319451123324.JavaMail.geo-discussion-forums@prib32> |
| In reply to | #11014 |
Manual morphing the type of a pointer which points to different types in the run time without a clear purpose is a useful trick, but this trick is not recommended in C++ most of the time.
[toc] | [prev] | [next] | [standalone]
| From | Jorgen Grahn <grahn+nntp@snipabacken.se> |
|---|---|
| Date | 2011-10-24 20:17 +0000 |
| Message-ID | <slrnjabhtu.1bk.grahn+nntp@frailea.sa.invalid> |
| In reply to | #11063 |
On Mon, 2011-10-24, 88888 Dihedral wrote: > Manual morphing the type of a pointer which points to different > types in the run time without a clear purpose is a useful trick, but > this trick is not recommended in C++ most of the time. I *think* I agree with what you *really* mean, but what you write makes no sense. How can something "without a clear purpose" be a "useful trick", and what do you really mean? /Jorgen -- // Jorgen Grahn <grahn@ Oo o. . . \X/ snipabacken.se> O o .
[toc] | [prev] | [next] | [standalone]
| From | someone <newsboost@gmail.com> |
|---|---|
| Date | 2011-10-18 16:35 -0700 |
| Message-ID | <49d0476d-4296-415f-8593-4fe9ce497e6d@m19g2000vbm.googlegroups.com> |
| In reply to | #10957 |
On Oct 18, 10:04 am, Werner <wer...@gmail.com> wrote: > On Oct 17, 9:20 pm, someone <newsbo...@gmail.com> wrote: > > [snip] > > > Maybe it's a simple question for you... When I wrote the first post, I > > confused myself a bit. I still think this is not very C++'ish, but > > it's the best I can do now, but I would like to learn from someone > > here if you have better suggestions :-) > > > Thanks for any comments, if you like... If not, then this is the way > > it's gonna be - it works :-) > > Adding to what Victor said, I've looked at the interface, and I think > this is a better example of what you should do. I've replaced the > library classes with my own placeholders. Note that no private > data exists. This compiles and runs fine courtesy of ideone. Thanks a lot for doing that! Fantastic work - I must say that I had to add "include<stdlib.h>" for it to compile, but it looks really good and definately, there's something I can learn from... I tried to modify your code and use it on my own - however I get a "segmentation fault" - not sure why... I'll have to look into it and prepare/post a better reply tomorrow... It's really a great help, that you made this. Thanks - I'll be back, after I've slept (am too tired now)...
[toc] | [prev] | [next] | [standalone]
| From | Werner <werasm@gmail.com> |
|---|---|
| Date | 2011-10-19 04:06 -0700 |
| Message-ID | <3934a151-fee8-42f6-9e2b-17435f615903@j20g2000vby.googlegroups.com> |
| In reply to | #10977 |
On Oct 19, 1:35 am, someone <newsbo...@gmail.com> wrote: > Thanks a lot for doing that! Fantastic work - I must say that I had to > add "include<stdlib.h>" for it to compile, but it looks really good > and definately, there's something I can learn from... Rather use <cstdlib>. It caters for c++ better (as opposed to c). Yes, the compiler I used did not require additional includes for NULL. I cut and paste the definition from the graph API without looking. > I tried to modify your code and use it on my own - however I get a > "segmentation fault" - not sure why... The code I gave you runs as is. You can view the output of this: http://ideone.com/JIlfF I've modified mysample_impl to access the reader as proof of concept. This would mean you have some problem in your code. In: gr.Window( argc, argv, mysample, "My Window", &myBinReader ); I would make sure that myBinReader starts out simply. You can even make it an integer or a vector of ints to test the concept. Remember to replace the placeholders with the actual graph API... Regards, Werner
[toc] | [prev] | [next] | [standalone]
| From | someone <newsboost@gmail.com> |
|---|---|
| Date | 2011-10-19 09:30 -0700 |
| Message-ID | <06bb41a9-48da-4435-ba24-fca520df4f9a@l7g2000yqh.googlegroups.com> |
| In reply to | #10986 |
On Oct 19, 1:06 pm, Werner <wer...@gmail.com> wrote: > On Oct 19, 1:35 am, someone <newsbo...@gmail.com> wrote: > > > Thanks a lot for doing that! Fantastic work - I must say that I had to > > add "include<stdlib.h>" for it to compile, but it looks really good > > and definately, there's something I can learn from... > > Rather use <cstdlib>. It caters for c++ better (as opposed to c). > Yes, the compiler I used did not require additional includes > for NULL. I cut and paste the definition from the graph > API without looking. Ok. It's really great. I appreciate it a lot - extremely helpful for me... > > I tried to modify your code and use it on my own - however I get a > > "segmentation fault" - not sure why... > > The code I gave you runs as is. You can view the output > of this: > > http://ideone.com/JIlfF > > I've modified mysample_impl to access the reader as proof of > concept. This would mean you have some problem in your code. Yep - it's a really great example which I can learn (and have learned) a lot from. > In: > > gr.Window( argc, argv, mysample, "My Window", &myBinReader ); > > I would make sure that myBinReader starts out simply. You can Ok, my data passing / argument passing code works now... I just have another problem, which I think I can solve myself... The plot looks wrong... I think that the x-axis is wrong even though the text for the xlabel looks right. I'm actually a bit disappointed about this mathgl- library... But that is perhaps not something to discuss here... > even make it an integer or a vector of ints to test the > concept. Remember to replace the placeholders with the > actual graph API... Yep! It works (except that the graph looks wrong, but I think this is a bug not related to the argument passing). I spend approx. 5 hours figuring out what was wrong and why I got a segmentation fault... Turned out that I had to replace this line: gr.Window(argc,argv,mysample,"My window"); With this line: gr.Window(argc,argv,mysample,"My window", &myBinReader); Well... I learned my lesson now and next time, I'll not do so many mistakes with passing arguments to callback-functions :-) Thanks a lot! The replies I got was a huge (invaluable) help to me and I would never have sorted this out myself... :-)
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.c++
csiph-web