Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3 4

Author Topic: Don't Capitalize main()  (Read 5465 times)

Tahin

  • Bay Watcher
    • View Profile
Re: Don't Capitalize main()
« Reply #15 on: June 02, 2009, 10:18:33 am »

There's nothing wrong with using x and y as long they're tied to an object and not global variables, so you know what they're describing.
The true crime is then having X as a distinctly separate variable from x.
Logged

Muz

  • Bay Watcher
    • View Profile
Re: Don't Capitalize main()
« Reply #16 on: June 02, 2009, 10:41:50 am »

A friend of mine wrote a chat client with those :(

Socket = Sock
TCP Socket = sock
Test TCP socket = SOCK (the one that didn't work)
Accepted socket = sOCk
Some dummy socket = soCk
Connected socket = sokc

..and so on.

Then.. when I try something simple like send(sock, reply, MSGSIZE)
Oh carp.
Logged
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Yanlin

  • Bay Watcher
  • Legendary comedian.
    • View Profile
Re: Don't Capitalize main()
« Reply #17 on: June 02, 2009, 10:45:32 am »

Drarven coding kills.
Logged
WE NEED A SLOGAN!

Ultimuh

  • Bay Watcher
  • BOOM! Avatar gone! (for now)
    • View Profile
Re: Don't Capitalize main()
« Reply #18 on: June 02, 2009, 11:01:03 am »

Drarven coding kills.

Dwarves don't code, they be engravein'.
Logged

SolarShado

  • Bay Watcher
  • Psi-Blade => Your Back
    • View Profile
Re: Don't Capitalize main()
« Reply #19 on: June 02, 2009, 11:25:30 am »

My personal Variable naming rules re: capitalization:

1: all variables are lowercase. if multiword, use "cammel-case": "myCoolVar"

2: EXCEPT for final static class variables (more or less global constants) are ALL_CAPS_WITH_UNDERSCORES

Drarven coding kills.

Dwarves don't code, they be engravein'.
;D How do they compile? With a cave-in?
Logged
Avid (rabid?) Linux user. Preferred flavor: Arch

Yanlin

  • Bay Watcher
  • Legendary comedian.
    • View Profile
Re: Don't Capitalize main()
« Reply #20 on: June 02, 2009, 11:40:15 am »

My personal Variable naming rules re: capitalization:

1: all variables are lowercase. if multiword, use "cammel-case": "myCoolVar"

2: EXCEPT for final static class variables (more or less global constants) are ALL_CAPS_WITH_UNDERSCORES

Drarven coding kills.

Dwarves don't code, they be engravein'.
;D How do they compile? With a cave-in?

No. Magma.
Logged
WE NEED A SLOGAN!

Muz

  • Bay Watcher
    • View Profile
Re: Don't Capitalize main()
« Reply #21 on: June 02, 2009, 11:48:35 am »

Magma + water = memory
Logged
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Yanlin

  • Bay Watcher
  • Legendary comedian.
    • View Profile
Re: Don't Capitalize main()
« Reply #22 on: June 02, 2009, 12:53:26 pm »

Don't forget to pull that lever again or you'll have a buffer overflow.
Logged
WE NEED A SLOGAN!

Virex

  • Bay Watcher
  • Subjects interest attracted. Annalyses pending...
    • View Profile
Re: Don't Capitalize main()
« Reply #23 on: June 02, 2009, 05:29:04 pm »

If you want to have fun, define both main() and Main() and call Main() from main(). Then try to get someone else to understand what you're doing :P

Plus. X and Y (or x and y, but I always capitalise my variables to avoid accedentaly using an illegal name for a variable) are usualy fine if you're using them to refere to a location on a map or the screen. But if there could be confusion as to what map you're getting the X and Y from, you'd better rename them (or use different coordinate systems for each map :P)
Logged

Muz

  • Bay Watcher
    • View Profile
Re: Don't Capitalize main()
« Reply #24 on: June 03, 2009, 12:58:49 am »

Hmm.. capitalizing variables to accidentally avoid illegal names is actually a good trick. I didn't think of that :P
Logged
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Mr Tk

  • Bay Watcher
  • Would you like a mint? It's only waffer thin.
    • View Profile
Re: Don't Capitalize main()
« Reply #25 on: June 03, 2009, 08:35:40 am »

I've run Java programs in 3GB heaps for fun.

That reminds of an exception in C#. The OutOfMemory Exception.
Logged
First ten minutes of play I ate my loincloth and then got some limbs torn off by a super friendly rat. Thumbs up from me.

eerr

  • Bay Watcher
    • View Profile
Re: Don't Capitalize main()
« Reply #26 on: June 03, 2009, 01:16:41 pm »

so java does have more than 68 megabytes?

Thats why Jagex says they're limited to 68mb for funorb...
backwards compatability.
Logged

SolarShado

  • Bay Watcher
  • Psi-Blade => Your Back
    • View Profile
Re: Don't Capitalize main()
« Reply #27 on: June 04, 2009, 10:58:10 pm »

Speaking of illegal names, I was working on an RPG-ish game several years back. When I got to the point of writing the class for an in-game character (PC/NPC), I naturally named the class "Character"... If you're a Java programmer and don't know where this is going, go try it right quick.
Spoiler: Otherwise (click to show/hide)
Logged
Avid (rabid?) Linux user. Preferred flavor: Arch

cowofdoom78963

  • Bay Watcher
  • check
    • View Profile
Re: Don't Capitalize main()
« Reply #28 on: June 05, 2009, 03:32:14 am »

Ill be sure to remember this, as I have just started using C. :)
Logged

Muz

  • Bay Watcher
    • View Profile
Re: Don't Capitalize main()
« Reply #29 on: June 05, 2009, 07:16:41 am »

The most important rule in coding is that it's going to take a hell lot longer than you expect. Same rule also applies to electronic engineering.
Logged
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
Pages: 1 [2] 3 4