comp.lang.c++@googlegroups.com | Google Groups | ![]() |
Unsure why you received this message? You previously subscribed to digests from this group, but we haven't been sending them for a while. We fixed that, but if you don't want to get these messages, send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
- C++ obfuscator - 3 Updates
- C++ Books for new C++ Programmer (who is experienced in C and Python) - 3 Updates
- using c++ ast to determine unused headers (iwyu for gcc). - 1 Update
- How to organize class member variables and functions - 2 Updates
- unable to delete the value from a vector. - 1 Update
- to Tiib - 1 Update
"Öö Tiib" <ootiib@hot.ee>: Nov 23 01:06PM -0800 On Sunday, 23 November 2014 20:07:38 UTC+2, Wouter van Ooijen wrote: > > on their compilers and only give you the end results? That sounds rather > > distant kind of teaching. > So it sounds to me too, which is why I mostly don't work that way. Sorry, then I apparently misunderstood the problem. IOW ... Why you obfuscate the code? If the students have to present their tests then I see no reason why you should deliver them all the broken programs to test. Tests usually are made to find defects that are in code now but more importantly what will be made there by maintenance of future. So ... I did draw too far conclusions from that. |
Wouter van Ooijen <wouter@voti.nl>: Nov 23 11:18PM +0100 Geoff schreef op 23-Nov-14 8:26 PM: > and you need to distribute the source for the black box without > disclosing the > contents then the obfuscation tool would make sense. Spot on, that is exactly my sitiuation. Wouter |
Wouter van Ooijen <wouter@voti.nl>: Nov 23 11:20PM +0100 Öö Tiib schreef op 23-Nov-14 10:06 PM: > programs to test. Tests usually are made to find defects that are > in code now but more importantly what will be made there by maintenance > of future. So ... I did draw too far conclusions from that. I'd like to give the students the satisfaction of discovering/identifying more and more of the bugs while they are adding more tests. I am sure this is in agreement with some theory about learning but I don't know which one. Wouter |
"Öö Tiib" <ootiib@hot.ee>: Nov 23 01:42PM -0800 On Sunday, 23 November 2014 19:53:12 UTC+2, JiiPee wrote: > yes, I can see use for all of them except list the which I still have > not figured any use, as vector can do all what it is doing? What can the > list do the vector can not? 'std::list' has 'splice' member function that transfers part of list into other list. 'std::list' is extremely efficient for that 'splice'. If you have a problem for what best algorithm involves lot of transferring sub-sequences between sequence containers then 'std::list' is among winners and hard to beat. Such problems are rare and 'std::list' is not that good for most other things so it should not be the first choice of container. |
woodbrian77@gmail.com: Nov 23 01:44PM -0800 On Sunday, November 23, 2014 2:27:02 PM UTC-6, Ian Collins wrote: > > I would probably reject any code at review the defined a std namespace > > inside of a namespace as asking for problems, but is legal. > Legal, but stupid! It's a safeguard against ignorant and/or malicious users. Brian Ebenezer Enterprises - An ounce of prevention is worth more than a pound of cure. http://webEbenezer.net |
"Öö Tiib" <ootiib@hot.ee>: Nov 23 01:48PM -0800 On Sunday, 23 November 2014 21:18:36 UTC+2, Chicken Mcnuggets wrote: > No one has commented on these books. I'm hovering over the buy button on > Amazon but £80 for all three is quite a bit of cash and would like to > know if they are still recommended or not. I have read two of these. Good books, worth reading, not too dry. May save you some time if you want to really learn C++. |
"Öö Tiib" <ootiib@hot.ee>: Nov 23 01:23PM -0800 On Sunday, 23 November 2014 15:02:09 UTC+2, Glen Stark wrote: > statements are superfluous to a particular c++ file. I know that there's > a project to do this using clang, but I would like to do the same thing > for g++. One of driving forces behind of why clang is here is that g++ is sort of useless for making development tools from it. The C++ tools made with using clang are not only for clang. > As I understand it the gcc preprocessor provides a complete ast which > would allow me to do everything that's needed, but I'm having a hard time > getting started. The AST of g++ is partially optimized sometimes so on occasions even the diagnostics of its own say weird things. > Can anyone help me out? I'm particularly interested in links to good > documentation, but if anyone has any tips how they would go about doing > something like this, I'd be pleased hear them. Major difficulty are likely related with preprocessor. For example if some header is included only because of a macro and preprocessor has already expanded the macro then your tool will likely give false positive that the header is not needed. Or for other example if some header is included only for code that is compiled conditionally under certain defines and you analyse it with other defines then it will again give false positive. |
JiiPee <no@notvalid.com>: Nov 23 05:24PM On 23/11/2014 16:34, Öö Tiib wrote: > class named "ball". Then you have a class of object that has knowledge > and responsibilities to look, behave, sound and interact with other > objects in role of a ball. Ok, so you suggest to create a lot of small classes. The ball does not contain much as its a simple cirlcle really, but maybe it could also have a class I agree. How about the drawing context pointer (or the pointer to the window where the drawing is done): Is it best to pass it always as a parameter to a ball object when drawing needs to be done or ball object should save the pointer to its member variable and use it instead? I guess its better to pass it, right? > "Graphics" does not feel like a class of object ... notice that it is > plural. It is more likely a group of classes. Same is with "game objects". > Same is with the "communications" (servers and clients). Yes, Game class would contain a group of objects. How about creating functions as a member functions or global functions which take objects as a reference parameter? |
"Öö Tiib" <ootiib@hot.ee>: Nov 23 12:49PM -0800 On Sunday, 23 November 2014 19:25:01 UTC+2, JiiPee wrote: > Ok, so you suggest to create a lot of small classes. The ball does not > contain much as its a simple cirlcle really, but maybe it could also > have a class I agree. It is odd that you talk about your ball as "a simple circle". It looks like most prominent object of your game from the few lines of code you have posted. Lets see only data dedicated to it: sf::CircleShape ball; sf::Sound ballSound; sf::Sound ballSoundHit; sf::SoundBuffer ballSoundBuffer; sf::SoundBuffer ballSoundBufferHit; float ballSpeed; float ballRadius; float ballAngle; In my programs most of the classes have less data members. > to a ball object when drawing needs to be done or ball object should > save the pointer to its member variable and use it instead? I guess its > better to pass it, right? In general the window and ball are unrelated, each can live without other. So these interfaces feel odd: window.drawBall(); //so ball is something absolute or property of window? or ball.drawOnWindow(); //so window is something absolute or property of ball? Same ball may be displayed on several windows or several balls may be displayed on same window. May be not now but why to nail it down? Therefore such interfaces feel reasonable: window.draw(ball); or ball.drawOn(window); or draw(window, ball); > > plural. It is more likely a group of classes. Same is with "game objects". > > Same is with the "communications" (servers and clients). > Yes, Game class would contain a group of objects. The "game" should not do things that "ball" should do or "paddle" should do. > How about creating functions as a member functions or global functions > which take objects as a reference parameter? There are no absolute answers to that. If a function needs to access internal details of objects then it is better to make it as member. If function can be implemented in terms of public interface of objects, then it is better to write as free function. That is easy for me to say but novices are in difficulty with that because they do not realize what belongs to what and what should (or should not) expose what. For example ... there are zero cases I can imagine where a frame window should know or have anything to do with ball's radius ... yet it is property of your frame window. |
Ian Collins <ian-news@hotmail.com>: Nov 24 07:39AM +1300 K' Dash wrote: > dear all i want to delete the entry from a vector. but this piece of > code is not working. The if condition is not succesful but my vecoter > hold the entry. please help me Please wrap your lines! Why don't you use std::remove_if? -- Ian Collins |
Luca Risolia <luca.risolia@linux-projects.org>: Nov 23 12:44AM +0100 Il 23/11/2014 00:42, Luca Risolia ha scritto: > The only fact that using standard algorithms makes your code longer > should be a good a sign that they are going to be useful to solve your typo..I meant to say "*NOT* going to be useful" |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment