View Issue Details

IDProjectCategoryView StatusLast Update
0001219FSSCP---------public2007-01-22 23:41
Reportersefi Assigned ToGoober5000  
PrioritynormalSeverityblockReproducibilityalways
Status resolvedResolutionfixed 
Summary0001219: ai/aiturret.cpp:2056: error: expected unqualified-id before '||' token
DescriptionYou can't name a matrix "or". "or" is a keyword. Please correct it.
TagsNo tags attached.

Activities

2007-01-17 00:48

 

fs2or.patch (678 bytes)   
--- code/ai/aiturret.cpp~       2007-01-15 01:37:37.000000000 +0000
+++ code/ai/aiturret.cpp        2007-01-16 23:26:18.000000000 +0000
@@ -2053,8 +2053,8 @@
                if(tp->flags & MSS_FLAG_TURRET_HULL_CHECK){
                                polymodel *pm = model_get(shipp->modelnum);
                                mc_info test_collide;
-                               matrix or;
-                               vm_vector_2_matrix(&or, &v2e, NULL, NULL);
+                               matrix or2;
+                               vm_vector_2_matrix(&or2, &v2e, NULL, NULL);
                                vec3d start, end;

                                float r;
fs2or.patch (678 bytes)   

Srdjant

2007-01-17 00:48

reporter   ~0007475

Something like the above patch?

Goober5000

2007-01-22 21:33

administrator   ~0007520

Last edited: 2007-01-22 21:39

Umm... it's not a reserved word in C/C++. Unless you're using some sort of hybrid/extended compiler?

Nevertheless, it's an easy fix, so I'll go ahead and commit your patch. I'll close this in a few days if there are no other comments.

taylor

2007-01-22 22:47

administrator   ~0007524

It is an official ANSI C++ keyword actually. This isn't a problem with GCC, it's just that in typical Microsoft fashion, they don't follow the standard. MSVC++ would have the exact same problem if it was as standards strict as GCC is.

I have already fixed this several times before in the model code. I keep meaning to disable the most basic keywords (and, bitand, bitor, compl, not, or, xor) for non-Windows builds. Though technically, doing that would go against the C++ standard.


Just FYI though, the full list of ANSI C++ reserved keywords is:

explicit, bool, mutable, template, typeid,
typename, and, or, xor, bitor, compl, bitand,
and_eq, or_eq, xor_eq, not, not_eq, const_cast,
dynamic_cast, reinterpret_cast, static_cast,
true, false, namespace, using, throw, try, catch

Goober5000

2007-01-22 23:41

administrator   ~0007527

Ah, thanks. Good to know. :)

Marking as fixed then.

Issue History

Date Modified Username Field Change
2007-01-15 09:08 sefi New Issue
2007-01-17 00:48 Srdjant File Added: fs2or.patch
2007-01-17 00:48 Srdjant Note Added: 0007475
2007-01-17 05:31 taylor Status new => assigned
2007-01-17 05:31 taylor Assigned To => WMCoolmon
2007-01-17 05:31 taylor Assigned To WMCoolmon => Bobboau
2007-01-22 21:33 Goober5000 Note Added: 0007520
2007-01-22 21:39 Goober5000 Note Edited: 0007520
2007-01-22 22:47 taylor Note Added: 0007524
2007-01-22 23:41 Goober5000 Note Added: 0007527
2007-01-22 23:41 Goober5000 Assigned To Bobboau => Goober5000
2007-01-22 23:41 Goober5000 Status assigned => resolved
2007-01-22 23:41 Goober5000 Resolution open => fixed