LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-21-2010, 06:28 AM   #16
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454

Quote:
Originally Posted by Kenny_Strawn View Post
Here is my problem: I have a Vala program that includes classes with nested classes. When I try to initialize classes (using the variable type and the variable, followed by the class's arguments [three unsigned 8-bit integers] in parentheses) and try to compile the Vala code to C code (thanks Steshenko, that's what I tried to AVOID doing, as I really wanted to create a shared object file, but now I know I have to use C code as a middleman), the compiler tells me it expects a semicolon between the class variable name and its members.

What?! A semicolon in a bad place, that's for sure! Why would I want to put a semicolon *BETWEEN* the class initialization and its members? Isn't the whole point of a class to *HAVE* different members?

Here is my class:

Code:
public class Gtk.rgba : GLib.Object {
    public class fg_color : GLib.Object {
        private uint8 red;
        private uint8 green;
        private uint8 blue;
		
        //Constructor
        public fg_color(uint8 r, uint8 g, uint8 b) {
            r = red;
            g = green;
            b = blue;
			
            uint full_color = red * green * blue;
        }
    }
	
    public class bg_color : GLib.Object {
        private uint8 red;
        private uint8 green;
        private uint8 blue;
		
        //Constructor
        public bg_color(uint8 r, uint8 g, uint8 b) {
            r = red;
            g = green;
            b = blue;
			
            uint full_color = red * green * blue;
        }
    }
	
    //Toplevel constructor
    public rgba(var bg, var fg) {
        bg = bg_color;
        fg = fg_color;
    }
	
    public static void init(double alpha) {
        double alpha_t = alpha;

        //Here's where the error is
        for (alpha_t > 0; alpha_t < 1; ++alpha_t) {
            fg_color fg_increment(red++, green++, blue++);
            bg_color bg_decrement(red--, green--, blue--);
                                 ^ //The compiler is telling me to put a semicolon *HERE* <yawn>.
        }
    }
}

Prove that the compiler is wrong. I.e. take the language spec/standard, read it, show the relevant paragraphs and prove that the compiler is incompatible with the language spec/standard.

Had it been "C", I would have said "read the C99 standard". Notice, that the languages you are trying to use change, but your problems stay the say. The main problem typically is: expectations based on nothing.
 
  


Reply

Tags
expected-semicolon, vala, wrong-place



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
c code not running as expected isamuede Programming 6 04-28-2010 09:21 PM
Mail going to wrong place? alitrix Linux - Server 1 06-15-2008 01:58 PM
compiling looking in the wrong place for a libtool archive kryptobs2000 Linux - Software 5 01-05-2007 10:31 PM
I own everything! (did 'chown -R' in the wrong place) oskar Linux - Newbie 9 03-19-2006 05:38 PM
lilo in wrong place, help! krgue Linux - Software 4 05-22-2001 04:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration