gamedevlists-general Mailing List for gamedev (Page 16)
Brought to you by:
vexxed72
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
(28) |
Nov
(13) |
Dec
(168) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(51) |
Feb
(16) |
Mar
(29) |
Apr
(3) |
May
(24) |
Jun
(25) |
Jul
(43) |
Aug
(18) |
Sep
(41) |
Oct
(16) |
Nov
(37) |
Dec
(208) |
2003 |
Jan
(82) |
Feb
(89) |
Mar
(54) |
Apr
(75) |
May
(78) |
Jun
(141) |
Jul
(47) |
Aug
(7) |
Sep
(3) |
Oct
(16) |
Nov
(50) |
Dec
(213) |
2004 |
Jan
(76) |
Feb
(76) |
Mar
(23) |
Apr
(30) |
May
(14) |
Jun
(37) |
Jul
(64) |
Aug
(29) |
Sep
(25) |
Oct
(26) |
Nov
(1) |
Dec
(10) |
2005 |
Jan
(9) |
Feb
(3) |
Mar
|
Apr
|
May
(11) |
Jun
|
Jul
(39) |
Aug
(1) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
|
2006 |
Jan
(24) |
Feb
(18) |
Mar
(9) |
Apr
|
May
|
Jun
|
Jul
(14) |
Aug
(29) |
Sep
(2) |
Oct
(5) |
Nov
(4) |
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(11) |
Sep
(9) |
Oct
(5) |
Nov
(4) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(34) |
Jun
|
Jul
(9) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <ho...@bo...> - 2004-07-07 19:34:22
|
Forgive me for doing this as a single question, I'm writing this from a Web client... Going back to the __attribute((cdecl)) issue, I've found that this does NOT work when using GCC 3.3.4 for Athlon64. I get a warning that the attribute will be ignored. It compiles fine using GCC 3.3.1 for Cygwin however. So, back to the drawing board I guess. *sigh* Unrelated to this I just found out that Microsoft has the command line compiler from VC++ 7.2 available for download. I'd like to test it out, but I don't want it to screw up my VC++ 6.0 installation -- has anyone downloaded it and used it with VC++ 6 and not had the latter die? Thanks, Brian |
From: Luis V. <lui...@mi...> - 2004-07-07 19:06:29
|
AFAIK the C++ standard disallows declaring arrays with float variables. Array declarations require "integral constant expressions" which allow floating literals to be part of the constant as long as a cast is present to transform these to either integral or enumeration types. "integral constant expressions" do not allow float variables (even if they are constant) In your first example "const int a" is an "integral constant expression" because it is a const int. In the second example 5.4f and 3.6f are both floating literals and which are casted to an int. The third example uses const floats which are not part of the definition of "integral const expressions"; therefore the compiler rejects the code. Luis Villegas -----Original Message----- From: gam...@li... [mailto:gam...@li...] On Behalf Of Andras Balogh Sent: Wednesday, July 07, 2004 8:41 AM To: gam...@li... Subject: RE: [GD-General] not sure where to post this question... bit C++ implementation specific.... > How would that help? In C++ you simply cannot do this: >=20 > int a =3D 6; > int array[a]; >=20 > It is not possible to allocate arrays with variables (const or not const). I dunno, this compiles fine on MSVC++: const int a =3D 6; int array[a]; This also works fine: const int a =3D static_cast<const int>(5.4f / 3.6f); int array[a]; But then why it's not possible to do: const float a =3D 14.5f; const float b =3D 2.3f; const int c =3D static_cast<const int>(a / b); int array[c]; ? Andras ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 -=20 digital self defense, top technical experts, no vendor pitches,=20 unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ Gamedevlists-general mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-general Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D557 |
From: brian s. <pud...@po...> - 2004-07-07 18:03:33
|
AFAIK const floats (and const doubles) are treated differently because any compile-time arithmetic you do with them might not give the same results as runtime arithmetic. The results you get depend on what state you've buggered the FPU into (on both the compiling machine and the target machine). So VC will be cautious and defer any division of const floats until runtime, meaning that you can't use it in an array declaration. --brian Noel Llopis wrote: >On Wednesday 07 July 2004 05:23 am, Richard Fabian wrote: > > >>i seem to be able to safely issue declarations for int initialised >>arrays... >> >>e.g. >> >> const int ropeLength = 12.5f; >> const int knotSpace = 3.3f; >> int array[ (int)( ropeLength / knotSpace ) ]; >> >>is perfectly valid. >> >>it looks like it is quite literally the "const float"s that are at >>fault. >> >> > >If I recall correctly, const floats were treated very differently from const >ints in VC++. Const floats even generated their own bit of code to be >executed when they were initialized, whereas const ints became true consts, >so it doesn't surprise me that they can't be used as part of the array size. > >As some other people pointed out earlier, any reason not to use an >std::vector<> or do dynamic allocation? > >If you don't like having to delete the memory, you can always use >boost::scoped_array: >boost::scoped_array<int> array (new[ (int)( ropeLength / knotSpace ) ]); > > > > |
From: <cas...@ya...> - 2004-07-07 17:20:05
|
--- Brian Hook <ho...@bo...> wrote: > > Why don't you try: > > > > void __attribute__((cdecl)) foo( int x, int y, int z ); > > > > :) > > Err...hmmm, is that standard across all GCC incarnations? The man > pages I read indicated it had to be a suffix, but if not...well, that > simplifies things =) Hmm... I'm not totally sure. I think the documentation (http://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html) is not completely clear, but apparently that works at least on recent gcc versions. I've been using that for some time. So, please, let me know if you find any issue! Thanks, -- Ignacio Castaño cas...@ya... ______________________________________________ Yahoo! lanza su nueva tecnología de búsquedas ¿te atreves a comparar? http://busquedas.yahoo.es |
From: <phi...@pl...> - 2004-07-07 16:38:32
|
I'm not convinced that this isn't just a quirk of VC6. Cheers, Phil |
From: Richard F. <gd...@th...> - 2004-07-07 16:11:21
|
what about the dereference of the global pointer to get the address of the array? if the array was a global, then surely the address of the array would be in the instructions that access it? Would this not go so far as to compile out any const pointer arithmetic? On the PS2 and other memory issue intense machines, might not such pointer dereferencing be a real issue? ------------------ On the other hand I may be talking complete drivel. ------------------ > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] On > Behalf Of Noel Llopis > Sent: 07 July 2004 04:19 PM > To: gam...@li... > Subject: Re: [GD-General] not sure where to post this > question... bit C++ implementation specific.... > > > On Wednesday 07 July 2004 07:05 am, Richard Fabian wrote: > > > its actually more of a "didn't want to have to dereference > everytime i > > needed to access the array". speed issue... > > You do realize that, at least on a PC, it's just as fast > accessing an array on > the stack than one that was dynamically allocated, right? > Actually, if you're > accessing more than one int at the time, the > dynamically-allocated one might > be faster because of better memory alignment. > > And if you're talking about the extra indirection added by > boost::scoped_array... I admit I haven't measured, but I > doubt very, very > much you would notice any difference unless all your program > did was run in a > for loop accessing array elements. > > > The best fix in our situation will be to use defines as far > as i can > > see. > > Personally, I see nothing wrong with simple defines for > things like that. It's > when you start doing complicated macros that the > pre-processor can become > more of a problem than it solves. > > > --Noel > Games from Within > http://www.gamesfromwithin.com > > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & > Training. Attend Black Hat Briefings & Training, Las Vegas > July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=557 > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 |
From: Andras B. <bn...@ma...> - 2004-07-07 15:40:48
|
> How would that help? In C++ you simply cannot do this: > > int a = 6; > int array[a]; > > It is not possible to allocate arrays with variables (const or not const). I dunno, this compiles fine on MSVC++: const int a = 6; int array[a]; This also works fine: const int a = static_cast<const int>(5.4f / 3.6f); int array[a]; But then why it's not possible to do: const float a = 14.5f; const float b = 2.3f; const int c = static_cast<const int>(a / b); int array[c]; ? Andras |
From: Noel L. <nl...@co...> - 2004-07-07 15:19:20
|
On Wednesday 07 July 2004 07:05 am, Richard Fabian wrote: > its actually more of a "didn't want to have to dereference everytime i > needed to access the array". speed issue... You do realize that, at least on a PC, it's just as fast accessing an array on the stack than one that was dynamically allocated, right? Actually, if you're accessing more than one int at the time, the dynamically-allocated one might be faster because of better memory alignment. And if you're talking about the extra indirection added by boost::scoped_array... I admit I haven't measured, but I doubt very, very much you would notice any difference unless all your program did was run in a for loop accessing array elements. > The best fix in our situation will be to use defines as far as i can > see. Personally, I see nothing wrong with simple defines for things like that. It's when you start doing complicated macros that the pre-processor can become more of a problem than it solves. --Noel Games from Within http://www.gamesfromwithin.com |
From: Richard F. <gd...@th...> - 2004-07-07 14:06:22
|
> If I recall correctly, const floats were treated very > differently from const > ints in VC++. Const floats even generated their own bit of code to be > executed when they were initialized, whereas const ints > became true consts, > so it doesn't surprise me that they can't be used as part of > the array size. > > As some other people pointed out earlier, any reason not to use an > std::vector<> or do dynamic allocation? > > If you don't like having to delete the memory, you can always use > boost::scoped_array: > boost::scoped_array<int> array (new[ (int)( ropeLength / > knotSpace ) ]); its actually more of a "didn't want to have to dereference everytime i needed to access the array". speed issue... The best fix in our situation will be to use defines as far as i can see. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 |
From: Noel L. <nl...@co...> - 2004-07-07 13:52:26
|
On Wednesday 07 July 2004 05:23 am, Richard Fabian wrote: > i seem to be able to safely issue declarations for int initialised > arrays... > > e.g. > > const int ropeLength = 12.5f; > const int knotSpace = 3.3f; > int array[ (int)( ropeLength / knotSpace ) ]; > > is perfectly valid. > > it looks like it is quite literally the "const float"s that are at > fault. If I recall correctly, const floats were treated very differently from const ints in VC++. Const floats even generated their own bit of code to be executed when they were initialized, whereas const ints became true consts, so it doesn't surprise me that they can't be used as part of the array size. As some other people pointed out earlier, any reason not to use an std::vector<> or do dynamic allocation? If you don't like having to delete the memory, you can always use boost::scoped_array: boost::scoped_array<int> array (new[ (int)( ropeLength / knotSpace ) ]); --Noel Games from Within http://www.gamesfromwithin.com |
From: Richard F. <gd...@th...> - 2004-07-07 12:23:27
|
i seem to be able to safely issue declarations for int initialised arrays... e.g. const int ropeLength = 12.5f; const int knotSpace = 3.3f; int array[ (int)( ropeLength / knotSpace ) ]; is perfectly valid. it looks like it is quite literally the "const float"s that are at fault. ------------------ On the other hand I may be talking complete drivel. ------------------ > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] On > Behalf Of Jorrit Tyberghein > Sent: 07 July 2004 10:36 AM > To: gam...@li... > Subject: Re: [GD-General] not sure where to post this > question... bit C++ implementation specific.... > > > CAVEY GERARD wrote: > > > > >but why dont you just use some temp integers filled with the > abs values > >to create your array? It will only add few instructions. > >Instead of trying to destroy the wall ,just jump over :) > > > > > How would that help? In C++ you simply cannot do this: > > int a = 6; > int array[a]; > > It is not possible to allocate arrays with variables (const > or not const). > > Greetings, > > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & > Training. Attend Black Hat Briefings & Training, Las Vegas > July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=557 > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 |
From: Crosbie F. <cr...@cy...> - 2004-07-07 10:03:21
|
> From: Jorrit Tyberghein > How would that help? In C++ you simply cannot do this: >=20 > int a =3D 6; > int array[a]; >=20 > It is not possible to allocate arrays with variables (const=20 > or not const). Many apologies for the following hack, but once upon a time it was = needed. #if 0 #define CLASS_INT(N) _SClassInt##N #define CLASS_INT_STRUCT(N) typedef char CLASS_INT(N) [N] CLASS_INT_STRUCT(2); CLASS_INT_STRUCT(3); CLASS_INT_STRUCT(4); =09 #undef CLASS_INT_STRUCT #define NUMBER(NN) CLASS_INT(NN) #else #define NUMBER(NN) char [NN] #endif #define _2 NUMBER(2) #define _3 NUMBER(3) #define _4 NUMBER(4) #define INT_(NUM) (sizeof(NUM)) Maybe it could be used again? e.g. int array[INT_(NUMBER(6))]; But, there MUST be a better answer these days eh? Templates perhaps? |
From: Dr A. P. <aj...@eu...> - 2004-07-07 10:03:17
|
I think this comes from C99 complience - not standard yet. Cheers, Andrew > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...]On Behalf Of > CAVEY GERARD > Sent: 07 July 2004 10:54 > To: 'gam...@li...' > Subject: RE: [GD-General] not sure where to post this question... bit > C++ implementation specific.... > > > > > >How would that help? In C++ you simply cannot do this: > > > > int a = 6; > > int array[a]; > > > >It is not possible to allocate arrays with variables (const or > not const). > > Guys > > How can you explain the following code compiles under mingw32(IDE=devc++ > 4987)? > Do you use visual studio ? > Anyway i ll it a try on solaris. > > int main(int argc, char *argv[]) > { > > const float ropeLength = 12.5f; > const float knotSpace = 3.3f; > > int array[ int(ropeLength / knotSpace) ]; > > int a=6; > int arraybis[a]; > > return 0; > } > > > ************************************************************************* > Ce message et toutes les pieces jointes (ci-apres le "message") sont > confidentiels et etablis a l'intention exclusive de ses destinataires. > Toute utilisation ou diffusion non autorisee est interdite. > Tout message electronique est susceptible d'alteration. > SG Asset Management et ses filiales declinent toute > responsabilite au titre > de ce message s'il a ete altere, deforme ou falsifie. > > Découvrez l'offre et les services de SG Asset Management sur le site > www.sgam.fr > > ******** > > This message and any attachments (the "message") are confidential and > intended solely for the addressees. > Any unauthorised use or dissemination is prohibited. > E-mails are susceptible to alteration. > Neither SG Asset Management nor any of its subsidiaries or > affiliates shall > be liable for the message if altered, changed or falsified. > > ************************************************************************* > > > > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & Training. > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU7 > > _____________________________________________________________________ > This e-mail is confidential and may be privileged. It may be > read, copied and used only by the intended recipient. No > communication sent by e-mail to or from Eutechnyx is intended to > give rise to contractual or other legal liability, apart from > liability which cannot be excluded under English law. > > This message has been checked for all known viruses by Star > Internet delivered through the MessageLabs Virus Control Centre. > > www.eutechnyx.com Eutechnyx Limited. Registered in England No: 2172322 _____________________________________________________________________ This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. No communication sent by e-mail to or from Eutechnyx is intended to give rise to contractual or other legal liability, apart from liability which cannot be excluded under English law. This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Control Centre. www.eutechnyx.com Eutechnyx Limited. Registered in England No: 2172322 |
From: Jorrit T. <jor...@uz...> - 2004-07-07 09:56:36
|
CAVEY GERARD wrote: > >Guys > >How can you explain the following code compiles under mingw32(IDE=devc++ >4987)? >Do you use visual studio ? > > gcc supports this with a C++ extension. If you enable -Wpedantic then gcc will probably give an error or warning for that. Greetings, |
From: CAVEY G. <GER...@sg...> - 2004-07-07 09:52:29
|
> >How would that help? In C++ you simply cannot do this: > > int a =3D 6; > int array[a]; > >It is not possible to allocate arrays with variables (const or not = const). Guys How can you explain the following code compiles under = mingw32(IDE=3Ddevc++ 4987)? Do you use visual studio ? Anyway i ll it a try on solaris. int main(int argc, char *argv[]) { =20 const float ropeLength =3D 12.5f; const float knotSpace =3D 3.3f; =20 int array[ int(ropeLength / knotSpace) ]; =20 int a=3D6; int arraybis[a]; =20 return 0; } ************************************************************************= * Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite.=20 Tout message electronique est susceptible d'alteration.=20 SG Asset Management et ses filiales declinent toute responsabilite au = titre de ce message s'il a ete altere, deforme ou falsifie. D=E9couvrez l'offre et les services de SG Asset Management sur le site www.sgam.fr=20 ******** This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited.=20 E-mails are susceptible to alteration. =20 Neither SG Asset Management nor any of its subsidiaries or affiliates = shall be liable for the message if altered, changed or falsified.=20 ************************************************************************= * |
From: Fredrik B. <Fre...@st...> - 2004-07-07 09:47:30
|
> How would that help? In C++ you simply cannot do this: >=20 > int a =3D 6; > int array[a]; But you could always do std::vector<int> array(a); To get around it :-) STL is your friend. /Fredrik Bengtsson Blueberry3D |
From: Jorrit T. <jor...@uz...> - 2004-07-07 09:35:59
|
CAVEY GERARD wrote: > >but why dont you just use some temp integers filled with the abs values >to create your array? >It will only add few instructions. >Instead of trying to destroy the wall ,just jump over :) > > How would that help? In C++ you simply cannot do this: int a = 6; int array[a]; It is not possible to allocate arrays with variables (const or not const). Greetings, |
From: CAVEY G. <GER...@sg...> - 2004-07-07 09:11:10
|
>You've got to admit this is a bit of a stinker, and i can't see why = the >c++ langauge cannot cope with this simple premise. > >At the moment, the best compromise we can come up with is to #ifdef >VALUE #error#else#define VALUE 12.5f#endif >... do stuff with the constant ... >#undef VALUE > >we've got a good thing going on about not polluting the namespace, and >#defines can wreak havok on anything that hits them. but why dont you just use some temp integers filled with the abs values to create your array? It will only add few instructions. Instead of trying to destroy the wall ,just jump over :) GC. ************************************************************************= * Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite.=20 Tout message electronique est susceptible d'alteration.=20 SG Asset Management et ses filiales declinent toute responsabilite au = titre de ce message s'il a ete altere, deforme ou falsifie. D=E9couvrez l'offre et les services de SG Asset Management sur le site www.sgam.fr=20 ******** This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited.=20 E-mails are susceptible to alteration. =20 Neither SG Asset Management nor any of its subsidiaries or affiliates = shall be liable for the message if altered, changed or falsified.=20 ************************************************************************= * |
From: Jorrit T. <jor...@uz...> - 2004-07-07 08:58:58
|
Richard Fabian wrote: >You've got to admit this is a bit of a stinker, and i can't see why the >c++ langauge cannot cope with this simple premise. > >At the moment, the best compromise we can come up with is to #ifdef >VALUE #error#else#define VALUE 12.5f#endif >... do stuff with the constant ... >#undef VALUE > >we've got a good thing going on about not polluting the namespace, and >#defines can wreak havok on anything that hits them. > > > If you think #define's are so bad then why not use allocation then? Greetings, |
From: Richard F. <gd...@th...> - 2004-07-07 08:49:22
|
You've got to admit this is a bit of a stinker, and i can't see why the c++ langauge cannot cope with this simple premise. At the moment, the best compromise we can come up with is to #ifdef VALUE #error#else#define VALUE 12.5f#endif ... do stuff with the constant ... #undef VALUE we've got a good thing going on about not polluting the namespace, and #defines can wreak havok on anything that hits them. ------------------ On the other hand I may be talking complete drivel. ------------------ > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] On > Behalf Of Jorrit Tyberghein > Sent: 07 July 2004 09:17 AM > To: gam...@li... > Subject: Re: [GD-General] not sure where to post this > question... bit C++ implementation specific.... > > > Richard Fabian wrote: > > >its a bit C++ specific, but does anyone know of a way of getting the > >"meaning" of this to compile... > > > >const float ropeLength = 12.5f; > >const float knotSpace = 3.3f; > >int array[ ropeLength / knotSpace ]; > > > >... its sorta meaning we have to break our own coding > guidlines.... (no > >#defines unless truly necessary) > > > > > > > Well using #define is one way. > > The only other way is using allocation: > int* array = new int[ropeLength / knotSpace]; > But then you must remember to delete[] it later. > > Greetings, > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & > Training. Attend Black Hat Briefings & Training, Las Vegas > July 24-29 - > digital self defense, top technical experts, no vendor pitches, > unmatched networking opportunities. Visit www.blackhat.com > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=557 > > --- > Incoming mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 |
From: Richard F. <gd...@th...> - 2004-07-07 08:41:22
|
> >its a bit C++ specific, but does anyone know of a way of getting the > >"meaning" of this to compile... > > > >const float ropeLength = 12.5f; > >const float knotSpace = 3.3f; > >int array[ ropeLength / knotSpace ]; > > > >... its sorta meaning we have to break our own coding > guidlines.... (no > >#defines unless truly necessary) > Hi > > AFAIK the number of tokens in an array must be an integer . > An easy solution could be to compute the division in a temp > variable then see if it give us a modulo ,if yes increase by > one our result > and finally use that result to create the array. > > GC. that, my friend is not the problem... i wouldn't be much of a coder if i thought i could have "pi" elements in my array... The problem is that as long as there is a "const float" involved, the compiler will not listen to the fact that it is a const. e.g. if i replace "int array[ ropeLength / knotSpace ];", with "int array[ int(ropeLength / knotSpace) ];", or "int array[ (int)(ropeLength / knotSpace) ];", there is still a compilation error. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 |
From: CAVEY G. <GER...@sg...> - 2004-07-07 08:20:59
|
>its a bit C++ specific, but does anyone know of a way of getting the >"meaning" of this to compile... > >const float ropeLength =3D 12.5f; >const float knotSpace =3D 3.3f; >int array[ ropeLength / knotSpace ]; > >... its sorta meaning we have to break our own coding guidlines.... = (no >#defines unless truly necessary) Hi AFAIK the number of tokens in an array must be an integer . An easy solution could be to compute the division in a temp variable then see if it give us a modulo ,if yes increase by one our result=20 and finally use that result to create the array. GC. ************************************************************************= * Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses destinataires. Toute utilisation ou diffusion non autorisee est interdite.=20 Tout message electronique est susceptible d'alteration.=20 SG Asset Management et ses filiales declinent toute responsabilite au = titre de ce message s'il a ete altere, deforme ou falsifie. D=E9couvrez l'offre et les services de SG Asset Management sur le site www.sgam.fr=20 ******** This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited.=20 E-mails are susceptible to alteration. =20 Neither SG Asset Management nor any of its subsidiaries or affiliates = shall be liable for the message if altered, changed or falsified.=20 ************************************************************************= * |
From: Jorrit T. <jor...@uz...> - 2004-07-07 08:17:07
|
Richard Fabian wrote: >its a bit C++ specific, but does anyone know of a way of getting the >"meaning" of this to compile... > >const float ropeLength = 12.5f; >const float knotSpace = 3.3f; >int array[ ropeLength / knotSpace ]; > >... its sorta meaning we have to break our own coding guidlines.... (no >#defines unless truly necessary) > > > Well using #define is one way. The only other way is using allocation: int* array = new int[ropeLength / knotSpace]; But then you must remember to delete[] it later. Greetings, |
From: Richard F. <gd...@th...> - 2004-07-07 08:06:27
|
its a bit C++ specific, but does anyone know of a way of getting the "meaning" of this to compile... const float ropeLength = 12.5f; const float knotSpace = 3.3f; int array[ ropeLength / knotSpace ]; ... its sorta meaning we have to break our own coding guidlines.... (no #defines unless truly necessary) ------------------ On the other hand I may be talking complete drivel. ------------------ --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004 |
From: Brian H. <ho...@bo...> - 2004-07-07 05:18:06
|
> Why don't you try: > > void __attribute__((cdecl)) foo( int x, int y, int z ); > > :) Err...hmmm, is that standard across all GCC incarnations? The man pages I read indicated it had to be a suffix, but if not...well, that simplifies things =3D) Brian |