Talk:C plus plus:Tutorials:Vectors

From GPWiki

Files:GUITutorial_warn.gif The Game Programming Wiki has moved! Files:GUITutorial_warn.gif

The wiki is now hosted by GameDev.NET at wiki.gamedev.net. All gpwiki.org content has been moved to the new server.

However, the GPWiki forums are still active! Come say hello.

Just a license thing could someone comfirm this is public domain or something similar? I'm not worried about the right to put it up her just thinking in case someone does actually want to use it in their code, it's nice to have a little reassurance. GDFL isn't really appropriate for use with code in a program. Xmp


Yes, you can go ahead and use it as though it were in the public domain. If you plan on redistributing this article as a document, then the GNU FDL would apply. But if anyone wants to use it in a program, they may feel free to do so!

Ryan Clark 20:33, 28 Nov 2004 (EST)


Affirmative. I wrote them and I don't plan on sueing you. --Marijn


I have two questions:

  1. why is an article listing C++ code included in the C section?
  2. why was this library pasted here and converted into an article instead of uploading the library somewhere and listing a link?

--Mecanismo 10:50, 21 Aug 2005 (EDT)

bad design?

The use of functions to return and set the x,y,z are very much out of style with most coders. I recommend removing that. Other than that, the class looks great!


private:

 T _c[3];

this is a very bad design

public:

 T x,y,z;

if you need a pointer to the data, just do:

operator T*(){ return (T*)this; }


I would have done it like that, exept that this is undefined behaviour according to the C++ standard - the compiler may lay out the class in memory as it pleases, so taking the adress of the object and casting it to a pointer is not guaranteed to give you a valid array. It will work on pretty much every compiler though, but *I* think having your code rely on undefined behaviour is bad design :P --Marijn