LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 07-03-2010, 01:46 AM   #16
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59

Well, I agree it's not helpful, but this thread really takes on a satirical component And, repeating the same hints over and over (like: "look, what exactly your function DOES") probably won't help either ... until the OP finally accepts the fact he has FUNDAMENTAL misconceptions and starts reading a book, maybe returning with some specific questions, making some sense
 
1 members found this post helpful.
Old 07-03-2010, 01:47 AM   #17
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Kenny, we have seen this, or variations of this, code before. I am going to make one very strong recommendation. Please describe in English what you would like this code to achieve. Please don't post any more code until you have done that because it really isn't possible to help you properly until you are able to state exactly in a non-programming way what you are trying to achieve.

Last edited by graemef; 07-03-2010 at 02:16 AM.
 
1 members found this post helpful.
Old 07-03-2010, 01:58 AM   #18
pr_deltoid
Member
 
Registered: Jun 2010
Distribution: Fedora
Posts: 289

Rep: Reputation: 41
Quote:
Originally Posted by zirias View Post
Uhm -- lol. "Some reason" could be that your code does a handful of computations, only to throw the results completely away. Really, learn some structured/imperative programming first, start with "hello world¨...
This post doesn't show me any evidence whatsoever of your personal ability to program. Start with "hello world".

Last edited by pr_deltoid; 07-03-2010 at 01:59 AM.
 
Old 07-03-2010, 02:00 AM   #19
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
Quote:
Originally Posted by prdeltoid View Post
This post doesn't show me any evidence whatsoever of your personal ability to program.
So what? Who are you?
 
Old 07-03-2010, 02:02 AM   #20
pr_deltoid
Member
 
Registered: Jun 2010
Distribution: Fedora
Posts: 289

Rep: Reputation: 41
I'm someone who posts when they know something instead of posting to act like they know something. Now jabber at me, I have better things to do.
 
Old 07-03-2010, 02:03 AM   #21
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Guys, personal attacks are something the LQ Rules prohibit.

So please knock it off at once – keep the discussion focused on the technical issues at hand.
 
Old 07-03-2010, 02:06 AM   #22
zirias
Member
 
Registered: Jun 2010
Posts: 361

Rep: Reputation: 59
How about doing your better things and NOT posting then? But maybe, a nice self-contradiction is the salt still missing in this stupid thread...
 
Old 07-03-2010, 02:06 AM   #23
pr_deltoid
Member
 
Registered: Jun 2010
Distribution: Fedora
Posts: 289

Rep: Reputation: 41
zirias, where are your "better things"? "ROFL"? Get a hobby. You're ignored.
 
Old 07-03-2010, 02:51 AM   #24
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
Code modified so that the inclusion of GTK-related files isn't senseless:

Code:
#include <glib.h>
#include <glib/gtypes.h>
#include <gtk/gtk.h>

void rgba(guint16 Red, guint16 Green, guint16 Blue, float Alpha) {
    guint32 pixel;

    double aRed = Alpha*(Red);
    double aGreen = Alpha*(Green);
    double aBlue = Alpha*(Blue);
	
    double rBlend = (1 - Alpha)*Red + Alpha*(aRed);
    double gBlend = (1 - Alpha)*Green + Alpha*(aGreen);
    double bBlend = (1 - Alpha)*Blue + Alpha*(aBlue);
    return;
}
Note the GTK-specific guint16 and guint32 declarations and the use of the 'pixel' declaration. Now GTK-related files are included for a purpose. And the computations are formulas taken from Wikipedia for alpha blending.
But the code is still senseless - it just burns CPU cycles not changing anything in the calling scope. You can change only one senseless thing at a time ?

Still, in the big scheme of things the now resolved issue of previously in vain included header files is a smaller issue. The big issue is that you still completely miss the very fundamentals of procedural programming regarding return values.

And because of these fundamental issues your C++ code in another thread is as senseless as this one.

The fact that you take formulae from Wikipedia does not necessarily make you code sensible - it's not the formulae you have problems with, it the programming concepts.

Last edited by Sergei Steshenko; 07-03-2010 at 02:57 AM.
 
Old 07-03-2010, 03:33 AM   #25
easuter
Member
 
Registered: Dec 2005
Location: Portugal
Distribution: Slackware64 13.0, Slackware64 13.1
Posts: 538

Rep: Reputation: 62
Quote:
Originally Posted by ForzaItalia2006 View Post
Right, hints are good and were totally appropriate in this post, because the OP seems to be missing some fundamental programming concepts.

@Kenny_Strawn: you should generally not be offended if someone tells you that you need a bit better understanding of some fundamentals. That should just help you to avoid such errors in the future.

BUT, I totally agree with Kenny_Strawn, that there are different ways to tell someone to dig further into the details. And just laughing at someone is definitely NOT the correct way. I think MOST of us were beginners at some time ;-)
I and others have already suggested he start with the basics (eg: http://www.linuxquestions.org/questi...ml#post4021155) because lots of the code he posts just has too much wrong with it to bother picking it all apart. Otherwise I may as well start transcribing parts of my programming books onto this forum because the authors have already dealt with the dozens of mistakes that Kenny_Strawn is making.

Sorry, I don't think that the laughing is inappropriate here: he has done this repeatedly in other threads and told (at first, nicely) half a dozen times that he needs to get the basics of programming mastered before posting nonsensical code which from what I can tell he doesn't even test.

Quote:
Originally Posted by Kenny_Strawn
Reported. This is rude and an ad hominem attack. I've had enough ridicule.
Actually I could explain why it isn't and ad hominem attack, but what's the point? You'd just arrogantly proclaim that you're the one who's right. So far you have completely ignored everyone's suggestions to help you, even though you are supposedly seeking for help.

Last edited by easuter; 07-03-2010 at 03:56 AM.
 
Old 07-03-2010, 05:09 AM   #26
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
To various posters here: No more personal jabs please. Either help with the problem or stay silent.

Note that it IS acceptable to suggest that someone needs to learn more fundamentals before tackling a particular kind of problem.
 
Old 07-03-2010, 06:09 AM   #27
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by pixellany View Post
Either help with the problem or stay silent.
I believe the OP solved the problem soon after posting it, and edited the solution into the first post, but neglected to mark the thread solved.

For anyone confused about the original problem, the following line of code
Code:
unsigned long rgbCube = Red * Green * Blue;
gave a confusing error message when it was included directly in the body of a class definition.

That is an invalid line of code directly in a class definition. But the compiler is not designed to recognize what such a line of code would mean elsewhere and tell you clearly that you can't do that in a class definition. Instead, the compiler reads up to the '=' and at that point realizes that nothing valid in the current context could have an '=' there.

The OP corrected it by changing a class into a function.
 
Old 07-03-2010, 11:51 AM   #28
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791

Original Poster
Blog Entries: 62

Rep: Reputation: 56
I am now trying to use members of a struct (_GdkColor) in an included file as part of the function, and when I do I get the following *NEW* compilation error:

Code:
librgbamap.c:7: error: expected ‘)’ before ‘.’ token
What is causing this? Isn't the whole point of locating struct members to use dots, even if inside parentheses or brackets?
 
Old 07-03-2010, 11:58 AM   #29
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
I am now trying to use members of a struct (_GdkColor) in an included file as part of the function, and when I do I get the following *NEW* compilation error:

Code:
librgbamap.c:7: error: expected ‘)’ before ‘.’ token
What is causing this? Isn't the whole point of locating struct members to use dots, even if inside parentheses or brackets?
You haven't shown your full source code.
You haven't shown your full command line.
You haven't shown the above command line full screen output.
 
1 members found this post helpful.
Old 07-03-2010, 01:36 PM   #30
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by Kenny_Strawn View Post
I am now trying to use members of a struct (_GdkColor) in an included file as part of the function, and when I do I get the following *NEW* compilation error:

Code:
librgbamap.c:7: error: expected ‘)’ before ‘.’ token
What is causing this?
Compiler messages are often unclear. That error message doesn't tell us much more than it tells you.

At that '.' the compiler ran out of possibilities for valid interpretations of your code. C++ is a complicated language, so there might be valid interpretations well past the actual point of error. So the fact that the '.' can't be valid there means little and the fact that a ')' could be valid there means even less.

How can you expect anyone to tell you what is wrong with your code, when you didn't show the code?

Quote:
Isn't the whole point of locating struct members to use dots, even if inside parentheses or brackets?
You seem to be making flawed assumptions about the nature of the problem.
 
  


Reply

Tags
interesting



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
gcc 4.4.3 compilation error pankajd Linux - Software 1 04-03-2010 09:50 AM
gcc (GCC) 4.3.2 20081105 (Red Hat 4.3.2-7) compilation error adhesh_19 Red Hat 0 01-05-2010 05:34 AM
5.4. GCC-4.0.3 - Pass 1 compilation error :( gothicbob Linux From Scratch 1 08-06-2007 05:21 PM
have gcc compilation error during gcc installtion in linuxfromscratch vbshanmugaprakash Linux - General 3 12-13-2006 05:52 AM
gcc compilation error Proger Programming 1 03-22-2003 12:32 PM

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

All times are GMT -5. The time now is 01:25 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