1. [OT] Speaking of C...
- Posted by jaygade Jun 11, 2013
- 2106 views
I'm not a professional developer, but I found this C quiz interesting. There are a couple of gotchas in there.
2. Re: [OT] Speaking of C...
- Posted by jaygade Jun 17, 2013
- 1838 views
Another interesting link: http://gcc.godbolt.org/
This is an interactive C compiler with a variety of asm targets. The filter options are amazing! This tool could save a lot of time when you have a problem piece of code.
It would be pretty handy if we had a tool like this for interactively compiling Euphoria to IL or to C.
3. Re: [OT] Speaking of C...
- Posted by Lnettnay Jun 17, 2013
- 1829 views
I don't know what I'm doing wrong. I typed in the following:
- int c;
c = 0; ## and after the second line I got an error saying "C++ requires a type specifier for all declarations".
- int c;
Any idea what I'm doing wrong?
4. Re: [OT] Speaking of C...
- Posted by mattlewis (admin) Jun 17, 2013
- 1802 views
I don't know what I'm doing wrong. I typed in the following:
int c;\\ c = 0;and after the second line I got an error saying "C++ requires a type specifier for all declarations".
Any idea what I'm doing wrong?
Is that the entire file? You can't have executable statements at top level like in Euphoria. You can make some assignments, like:
int c = 0;
Can you tell us more what you're trying to do?
Matt
5. Re: [OT] Speaking of C...
- Posted by Lnettnay Jun 17, 2013
- 1833 views
Okay, now something is really squirrelly. On my last post this is what was in the edit box:
I don't know what I'm doing wrong. I typed in the following:\\ ## int c;\\ c = 0; ## and after the second line I got an error saying "C~++ requires a type specifier for all declarations".
And this is what the preview looked like:
I don't know what I'm doing wrong. I typed in the following: int c; c = 0; and after the second line I got an error saying "C++ requires a type specifier for all declarations".
But now, when Matt quotes it some of the formatting is different. ?!?
6. Re: [OT] Speaking of C...
- Posted by Lnettnay Jun 17, 2013
- 1814 views
Just pucking around. Not really trying to do anything. Just trying to see what it does.
7. Re: [OT] Speaking of C...
- Posted by jaygade Jun 17, 2013
- 1827 views
Wrap it in a function like main().
int main(void) { int c; c = 0; return c; }
I also found that you want to make sure to change or delete the compiler options field when trying different targets -- at first I thought that some of them weren't working but it was because the specific targets didn't understand the "-march=native" switch.
Edit: As I've been messing with C files doing experiments, I keep running into pitfalls like C has no top-level statements and that printf() does not take '1' as its first argument!
8. Re: [OT] Speaking of C...
- Posted by mattlewis (admin) Jun 17, 2013
- 1753 views
But now, when Matt quotes it some of the formatting is different. ?!?
I like to reformat quotes when I quote them. I also like to reformat posts that can benefit greatly from a well placed eucode tag or triple braces.
Matt
9. Formatting options
- Posted by Lnettnay Jun 17, 2013
- 1805 views
So the ##code text## actually means monospaced text. Does it have to be bracketed by the ##'s? And does it all have to be strung together without returns/line feeds?
10. Re: Formatting options
- Posted by jaygade Jun 17, 2013
- 1773 views
So the ##code text## actually means monospaced text. Does it have to be bracketed by the ##'s? And does it all have to be strung together without returns/line feeds?
Actually you want to use {{{ at the beginning of a line all by itself, and close with }}} on its own line.
See CreoleHelp. See also http://wikicreole.org/wiki/CheatSheet.
Edit: Also, while <eucode></eucode> tags are designed for Euphoria, other languages like C are close enough that it still colors them rather nicely.
Edit 2: Try "reply with quote" on a few messages to see how they are written.
11. Re: Formatting options
- Posted by mattlewis (admin) Jun 17, 2013
- 1792 views
So the ##code text## actually means monospaced text. Does it have to be bracketed by the ##'s? And does it all have to be strung together without returns/line feeds?
You can
put stuff on multiple lines, and it's like any other bit of creole text.
- #
But if you add whitespace after the opening number signs, it gets interpreted as a numbered list. If you're going to post code, I suggest using eucode tags. It will syntax highlight for euphoria. You might prefer to post stuff in other languages inside the triple braces. They are the equivalent of pre html tags. I tend to use them for console output.
Matt
12. Re: [OT] Speaking of C...
- Posted by Lnettnay Jun 17, 2013
- 1802 views
Wrapping it gets it to work. Thank you.
The optimization that it does with -O2 just does the calculations and returns the result. I found out that if you don't initialize your variables it just returns with no value. Bet that would be fun to debug.