<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Wierdest error I have ever seen</title>
		<link>http://www.allegro.cc/forums/view/274361</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 11 Jun 2003 05:44:05 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>As you can tell by the incredibly informative title, i have a strange error. Here is the exact code I am using.</p><div class="source-code snippet"><div class="inner"><pre>TMenu::TMenu<span class="k2">(</span> <a href="http://www.allegro.cc/manual/BITMAP" target="_blank"><span class="a">BITMAP</span></a> <span class="k3">*</span> _background, <span class="k1">int</span> x, <span class="k1">int</span> y, <span class="k1">int</span> major_val <span class="k2">)</span><span class="k2">:</span>
middle_x<span class="k2">(</span> x <span class="k2">)</span>,
middle_y<span class="k2">(</span> y <span class="k2">)</span>,
major<span class="k2">(</span> major_val <span class="k2">)</span><span class="k2">{</span> <span class="c">// error on this line</span>
  background <span class="k3">=</span> _background<span class="k2">;</span>
  previous <span class="k3">=</span> NULL<span class="k2">;</span>

  mouse.x <span class="k3">=</span> x<span class="k2">;</span>
  mouse.y <span class="k3">=</span> y<span class="k2">;</span>
  mouse.grab<span class="k2">(</span> background <span class="k2">)</span><span class="k2">;</span>
  selected <span class="k3">=</span> NULL<span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>

On the line i have commented, i get this error from gcc:
</p><div class="source-code snippet"><div class="inner"><pre>TMenu.cpp:13:anachronistic old style base <span class="k1">class</span> initializer
TMenu.cpp:13: unnamed initializer <span class="k1">for</span> <span class="s">'TMenu'</span>, which has no base classes
</pre></div></div><p>
The above code worked before i added major( major_val ) so i have no idea what an anachronistic old style whatever is.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kazzmir)</author>
		<pubDate>Wed, 11 Jun 2003 01:17:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
What type is major?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Wed, 11 Jun 2003 02:56:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>cmon, im not stupid. major is an int.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kazzmir)</author>
		<pubDate>Wed, 11 Jun 2003 03:09:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Is major inherited (and I assume middle_x and middle_y are not)?</p><p>If so, initialize that variable in the constructor body instead ...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (23yrold3yrold)</author>
		<pubDate>Wed, 11 Jun 2003 03:12:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>TMenu is a base class that no class is derived from. All variables are contained in TMenu. Major is declared in the next line down from middle_x, middle_y, more specifically it is declared protected.</p><p>Yes, declaring it in the constructor body works but i was just wondering why the way im doing it gives an error.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kazzmir)</author>
		<pubDate>Wed, 11 Jun 2003 03:23:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Is major defined as a macro somewhere.  I had that problem in a class once that some macro from a UNIX header happened to be the same name, and it generated weird warnings.</p><p>Try playing with the spaces, seeing if it&#39;s a bug in GCC.  Make sure the initializer list is in order of declaration (but that would give you a warning, and not an error).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gillius)</author>
		<pubDate>Wed, 11 Jun 2003 05:29:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Yea, apparently this code reveals a warning:
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#ifdef major</span>
<span class="p">#warning WTF??</span>
<span class="p">#endif</span>
</pre></div></div><p>

Upon further investigation, major is defined by &lt;vector&gt;. I searched through the STL header files, but found no mention of major.</p><p>[edit] found it, or found a major being defined somewhere in the system. In /usr/include/linux/kdev_t.h on line 81 it defines major as
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#define major(d) MAJOR(d)</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kazzmir)</author>
		<pubDate>Wed, 11 Jun 2003 05:44:05 +0000</pubDate>
	</item>
</rss>
