@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10



Comments:

<0> Tough luck. Use google, find your own information, etc.
<1> calc fallback
<2> fallback = We are NOT your fallback channel. If you can't get help somewhere else (not related to C++) you won't get it here. If you keep going with this, chances are you'll get your *** booted.
<3> hi everyone. trying to learn c++. why won't my (very) simple program work? posted at http://pastebin.com/513066 , approx 10 lines of code.
<4> int main(int argc, char* argv[])
<4> Then use argv[1] instead of tekst[6]
<4> that is... argv[1] will be a pointer to the first argument on the command line.
<1> But only if argc >= 2
<3> there is no command line argument ... !
<1> Then why did you write main that way?
<1> Furthermore, this looks like C to me, not C++.
<3> shouldn't i?
<1> What are you trying to do?
<4> If you don't use commandline arguments, then you can use: int main(void)
<1> Anyway, whether C or C++, this program will never work.
<5> Looks like he's trying to make a call to f1 without making a call to f1 heh



<4> there are no other ways to make a program start, it calls one of those main functions, not a main(char[6])
<1> Are you trying to get input from the user, or on the command line?
<3> why is that? i'm just having the main() catching a string sent by the f1() function and print it. wouldn't that work?
<1> And exactly how is f1 going to call main?
<5> norw|guy: The f1 function doesn't run itself.
<1> 1.) It never references it. 2.) main is called by the system, not by internal functions.
<4> No, all programs start by calling a 'int main()'. You don't have such a function, so your program won't even link.
<1> main (as run defined it above) is the entry point into a C or C++ program.
<6> Off to office
<1> #include <string>
<3> but i don't have to start off with the main(), do i?
<1> #include <iostream>
<4> yes you do
<4> it doesn't have to be at the top of the file no.
<3> Run: i'm running it just fine by starting off with f1(), and having a printf in that func..
<3> ok, got it
<1> No, you're not.
<3> Solamente: not in the posted ver, obviously
<4> (and use: printf("%s", token); please, you're already introducing possible exploits here...)
<1> f1 returns the character \0
<1> Not "hello"
<1> No, wait
<1> It returns an undefined character.
<1> There's no telling what you'll get from it.
<3> what i am trying to achieve is this: i want main() to call f1(), which should return "hello". main() would then print the returned result.
<4> In C++ ?
<1> std::string f1() { return "hello"; } int main() { std::cout << f1(); }
<1> That's the C++ way to do it.
<4> #include <iostream>
<4> #include <string>
<1> With the two includes I .... yeah.
<4> std::string f1() { return "helllo"; }
<4> int main() { std::cout << f1() << std::endl; }
<3> i've been mucking about in c, have I?
<1> Well, Run added a newline/flush, but otherwise his is identical.
<1> Yes, you have.
<1> Book suggestion:
<4> I copied yours, I'd have told him how to do what he tried correctly :p
<1> "Accelerated C++" by Koenig & Moo
<1> Correctly?
<4> tried, correctly
<1> Mine did exactly what he was trying to do, without the newline. I had already mentioned the includes.
<4> I'd have told him how to do it in C thus, cause that is what he tried.
<1> And I was going to reiterate that.
<4> you are misreading my line...
<3> ok, thanks for your help :p feeling a bit stupid. i was reading the bloodshed c++ helpfile, which apparently is a help file for c ...?
<4> I'd have said:
<1> Anyway, norw|guy, you need to learn C++.
<4> #include <cstdio>
<4> char const* f1(void) { return "Hello"; }
<1> Whoa, whoa
<1> Stop there.
<4> int main(void) { printf("%s\n", f1()); }
<4> :p
<4> That is what he TRIED
<1> Well, even that would fail.
<4> but then working (ok, not 'correct')
<4> Are you telling me I made a mistake in a hello world program?
<1> Yep
<3> what does std::string do?
<4> That works.



<1> char const* f1(void) { static char const tekst[] = "hello"; return tekst; } // This, maybe.
<4> No, string literals are in read-only memory.
<1> You're returning a const pointer to a stack array.
<1> The fact that it might run on your OS and compiler does not make it correct.
<4> The pointer will never be moved or freed, because it points to unwritable memory.
<4> I'm pretty sure that is a standard requirement :/
<1> I don't care. It's an incorrect program.
<4> ok
<1> norw|guy: std::string is the C++ string type.
<7> why does an empty cl*** take up 2 bytes when I compile it with g++?
<3> ah, instead of using namespace ... got it
<7> implementation defined. The standard says "at least 1 byte"
<7> right?
<1> Right.
<1> What's your pack setting?
<7> mine?
<1> Alignment, etc.
<1> What's the OS? CPU?
<1> These all come into play.
<7> nothing
<7> it was just a generic question
<1> Anyway, sizeof(cl*** foo{} bar) will be at least 1.
<7> gotcha
<7> btw any of you using gcc-arm
<4> lol
<4> This is a *single* compiler error: http://pastebin.com/513198
<4> I don't think I ever saw a larger one.
<0> Oh my God
<8> that looks like a traceback
<4> It's not an easy error either :/
<4> like 600 is the end of main :/
<4> The error occurs as a result of trying to instantiate my spirit C++ parser.
<4> I have NO idea where the real error is.
<4> Hmm, error disappears with some #if 0 .. #endif
<4> time for a binary search method ;)
<4> I commented out line 214 - 505
<8> your file is a .cc right?
<4> yes
<9> hmm, empire at war demo, me grabby
<8> it claims line 600
<8> parser.cc:600: instantiated from here
<4> [18:01] <4> like 600 is the end of main :/
<4> [18:02] <4> The error occurs as a result of trying to instantiate my spirit C++ parser.
<4> error between 300 - 505
<4> error between 400 - 505
<4> error between 400 - 450
<10> hello
<4> error between 400 - 426
<10> hello worms
<4> Is that what your dad called you when you were a kid? Try a psychiatrist, not #C++.
<10> no my dad called me caterpillar
<11> Did you turn into a butterfly yet?
<4> Ok, I found the line where the error occurs.
<4> unqualified_id = (identifier | operator_function_id | conversion_function_id |
<4> lexeme_d['~' >> cl***_name] | // this causes the problem
<4> template_id);
<4> Why doesn't that work? Doesn't lexeme_d return just another rule_t ?
<8> I thought lexeme_d switched to "character" mode or something like that
<4> yes
<4> it should :)
<8> then you can still >> cl***_name ?
<4> But why does this cause a compile error?
<4> The >> just won't skip spaces anymore, I thought.
<10> hey i know what you're compiling... its a worm!
<8> it's been a couple years since I used it, but I thought you 'lost' some operators
<8> can it, dipstick
<4> Would this be a problem when cl***_name needs spaces?
<4> I'm not sure if lexeme_d 'propagates' to the rules that are contained in it.
<8> could be... unfortunately we're not quite ready to redo our parser, so nobody here is using Spirit right now
<10> is dipstick a new kind of internet worm?
<8> Run I think I ran into a problem attempting to do something similar
<4> Does the '~' have to be against the cl*** name anyway? :)
<4> for a destructor thus


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #c++
or
Go to some related logs:

C++ exercizes
mirc flooder
reonkadena nude
#MissKitten
linux sata2 raid compatibility list
hasaan 2
#AllNiteCafe
#java
#windows
irgiel masturbating



Home  |  disclaimer  |  contact  |  submit quotes