Let's get programmy!

If you have some randomness to share that you can't post elsewhere, this is the place to do it.
Post Reply

Is Assembly the best programming language?

Yes
3
9%
Oh God my eyes
3
9%
Oh God my brain
12
38%
I perform unholy incantations to keep Assembly at bay
4
13%
Real men write binaries by hand
10
31%
 
Total votes: 32
User avatar
redangelran
inlove with a mystery geek || is stalking someone

Posts:
1530

Re: Let's get programmy!

Post by redangelran »

$25 :o :o
"I don't mind waiting for people. Because the longer you wait, when you do meet, you'll be more happy."
-Mouri Ran

"Is a reason necessary? I don't know why you would kill someone but as for saving someone-- a logical mind isn't needed, right?"
-Kudo Shinichi

My Twitter||My MAL
-super stupid case fanatic, i'm waiting for you ♥-
ranger
Community Villain

Posts:
3588

Re: Let's get programmy!

Post by ranger »

THIS IS HILARIOUS


Image
Image
Image
Akonyl
Community Hero

Posts:
4200

Re: Let's get programmy!

Post by Akonyl »

clearly that guy should just learn to stop using deprecated functions/headers, geez. :P

I do like the two guys high-fiving over the mushroom cloud though.
User avatar
Kirbypepe
Wonder what I'll turn into =D

Posts:
135
Contact:

Re: Let's get programmy!

Post by Kirbypepe »

Akonyl wrote: clearly that guy should just learn to stop using deprecated functions/headers, geez. :P
^ =P

And Yeah I liked the flubber thing though that was funny


oh and

http://www.youtube.com/watch?v=b-Cr0EWwaTk
Last edited by Kirbypepe on October 24th, 2011, 10:17 am, edited 1 time in total.
Howdy Everyone=]

Things are fantastic. How about for you?

Thats cool.

Wait I just realized, who am I talking to????
Akonyl
Community Hero

Posts:
4200

Re: Let's get programmy!

Post by Akonyl »

lole

I'm suddenly reminded of all the stupid bugs I've had to fix, this one in particular from a guy I knew

Code: Select all

int main()
{
  //declarations
  int array[10];

  //initialization
  int i;
  for(i=0; i<=10; i++)
  {
    array[i]=0;
  }

  return 0;
}
infinite looped

best bug ever
User avatar
Callid
Ratio vincit omnia.

Posts:
1433

Re: Let's get programmy!

Post by Callid »

Akonyl wrote: I'm suddenly reminded of all the stupid bugs I've had to fix, this one in particular from a guy I knew

Code: Select all

int main()
{
  //declarations
  int array[10];

  //initialization
  int i;
  for(i=0; i<=10; i++)
  {
    array[i]=0;
  }

  return 0;
}
infinite looped

best bug ever
I had also called that to be faulty, but because of the ArrayIndexOutOfBoundsException it generates when i becomes 10...
Also, is this Java?
If  ;), :D, ;D, ::), :P, :-X, :o or >:D are attached, that paragraph may not be 100% serious. Seriously.
This link provides further information.
Callid Conia Pact - Petitions - Archive
Akonyl
Community Hero

Posts:
4200

Re: Let's get programmy!

Post by Akonyl »

it's a C/C++ bug, Java won't do it because it won't let you index out of arrays.

if it was java, it'd be a public static int main() anyway :P
User avatar
Callid
Ratio vincit omnia.

Posts:
1433

Re: Let's get programmy!

Post by Callid »

Akonyl wrote: it's a C/C++ bug, Java won't do it because it won't let you index out of arrays.

if it was java, it'd be a public static int main() anyway :P
Ah, IC. Still, I don't quite get where the loop comes in -.-

Actually, it's perfectly possible to have a method called "int main()" in Java, if the method is simply a non-public and non-static one. Actually, the reason I figured it wasn't Java was because of the array declaration, which would have looked way different in Java ::)
Also, considering that this method being an int is completely pointless (actually, isn't the method as well?), am I right to assume that C/C++ does not have voids?
If  ;), :D, ;D, ::), :P, :-X, :o or >:D are attached, that paragraph may not be 100% serious. Seriously.
This link provides further information.
Callid Conia Pact - Petitions - Archive
ranger
Community Villain

Posts:
3588

Re: Let's get programmy!

Post by ranger »

wanna know an easy way to know it was C/C++ rather than java?

he/she didn't put "int i" in the for loop, C doesn't let you do that shit
Image
Image
User avatar
Kirbypepe
Wonder what I'll turn into =D

Posts:
135
Contact:

Re: Let's get programmy!

Post by Kirbypepe »

No you can have voids

Code: Select all

void main()
{
//do stuff here

return;
}
is perfectly valid in c++. Although I know that a lot of people prefer it to be int main.
Howdy Everyone=]

Things are fantastic. How about for you?

Thats cool.

Wait I just realized, who am I talking to????
User avatar
Conia
Yurikochan's Husband
Conan Shuuichi

Posts:
5194

Re: Let's get programmy!

Post by Conia »

ranger wrote: wanna know an easy way to know it was C/C++ rather than java?

he/she didn't put "int i" in the for loop, C doesn't let you do that shit
You mean like:

for (int i=0;i<=10;i++)
{
cout<<i;
}

?
Cause I do that all the time so it is possible :-X
Image
ranger
Community Villain

Posts:
3588

Re: Let's get programmy!

Post by ranger »

Conia wrote:
ranger wrote: wanna know an easy way to know it was C/C++ rather than java?

he/she didn't put "int i" in the for loop, C doesn't let you do that shit
You mean like:

for (int i=0;i<=10;i++)
{
cout<<i;
}

?
Cause I do that all the time so it is possible :-X
For most compilers before C99 you can't initialize the variable in your for loop for C, you can however in C++

edit: sorry, my wording was kinda confusing before, but basically its easy to identify C because by just looking at the for loop variable initialization.  and Yeah you can do it in C++, like in your example above
Last edited by ranger on October 24th, 2011, 2:45 pm, edited 1 time in total.
Image
Image
Akonyl
Community Hero

Posts:
4200

Re: Let's get programmy!

Post by Akonyl »

Callid wrote: Ah, IC. Still, I don't quite get where the loop comes in -.-
because if you didn't have a loop, how would you have the program loop infinitely? :P

as for the purpose of the loop, of course it has no function in the example I used, but I was just putting in the part of the code necessary to replicate the bug (the part where he was initializing his array).

as for voids, while void functions are perfectly valid, void main() is different. Depending on the standard (C vs C++), void main() may or may not be allowed (specifically, you're allowed to do it in C but not C++ based on the ISO standard and g++ will yell at you if you attempt to compile a void main()), more on that hereif you actually care. It's there so that upon process completion the process can report its condition back to the calling script/whatever (Just like System.exit(int) in java), but I've never actually used it for that purpose, it's just habit now.

@ranger: Not sure if it's only some or all, but even in some C compilers (gcc) you can define your vars inside your loop anyway, I just chose not to.
ranger
Community Villain

Posts:
3588

Re: Let's get programmy!

Post by ranger »

gcc is after C99, so yeah you can have it in there
Image
Image
Akonyl
Community Hero

Posts:
4200

Re: Let's get programmy!

Post by Akonyl »

why's this topic on page 3 I mean geez guys :<

aside from page 3 topics, know what else makes me sad? When you write some code for later use, and when you get to the point where you can use it it turns out that it doesn't actually do what you need to so you need to hope you can overhaul it or have to rewrite it. D:
Post Reply