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 5466 times)

PTTG??

  • Bay Watcher
  • Kringrus! Babak crulurg tingra!
    • View Profile
    • http://www.nowherepublishing.com
Don't Capitalize main()
« on: June 01, 2009, 12:23:53 pm »

for all b12ers out there who are into c++, remember: don't capitalize main().
it's just wrong. don't do it.
don't capitalize main().

never, ever, ever write this:
Code: [Select]
int Main()
{
...
ever.
Logged
A thousand million pool balls made from precious metals, covered in beef stock.

Tormy

  • Bay Watcher
  • I shall not pass?
    • View Profile
Re: Don't Capitalize main()
« Reply #1 on: June 01, 2009, 01:12:31 pm »

Interesting, but what the heck is this?  ???
Logged

Willfor

  • Bay Watcher
  • The great magmaman adventurer. I do it for hugs.
    • View Profile
Re: Don't Capitalize main()
« Reply #2 on: June 01, 2009, 05:21:50 pm »

It's good advice is what it is.
Logged
In the wells of livestock vans with shells and garden sands /
Iron mixed with oxygen as per the laws of chemistry and chance /
A shape was roughly human, it was only roughly human /
Apparition eyes / Apparition eyes / Knock, apparition, knock / Eyes, apparition eyes /

eerr

  • Bay Watcher
    • View Profile
Re: Don't Capitalize main()
« Reply #3 on: June 01, 2009, 05:30:06 pm »

and if you want to make videogames and don't know c, but do know java, just forget it.

java is limited to 68 megabytes of memory.
Logged

SolarShado

  • Bay Watcher
  • Psi-Blade => Your Back
    • View Profile
Re: Don't Capitalize main()
« Reply #4 on: June 01, 2009, 06:33:35 pm »

java is limited to 68 megabytes of memory.
:o Are you sure? I've never heard that.

Also: @PTTG:  ::) ::) I've been known to do that, java doesn't like it either. I doesn't like "Public static void main(String[] arg)" either.
Logged
Avid (rabid?) Linux user. Preferred flavor: Arch

Tahin

  • Bay Watcher
    • View Profile
Re: Don't Capitalize main()
« Reply #5 on: June 01, 2009, 06:43:07 pm »

Every single programming language in existence that is written for adults is case sensitive. Get used to it.
Logged

SolarShado

  • Bay Watcher
  • Psi-Blade => Your Back
    • View Profile
Re: Don't Capitalize main()
« Reply #6 on: June 01, 2009, 06:59:56 pm »

Every single programming language in existence that is written for adults is case sensitive. Get used to it.

True, but it doesn't make those stupid little typos any less anoying.
Logged
Avid (rabid?) Linux user. Preferred flavor: Arch

JoshuaFH

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

Can someone explain the joke to someone that is programming illiterate?
Logged

SolarShado

  • Bay Watcher
  • Psi-Blade => Your Back
    • View Profile
Re: Don't Capitalize main()
« Reply #8 on: June 01, 2009, 07:41:14 pm »

Can someone explain the joke to someone that is programming illiterate?

The method (named chunck of code) that is called (run) automaticly when the program starts is "main". If you accidently name it "Main" instead, it'll still compile (or it Java it will), but you'll get an arror when you try to run the program.
Logged
Avid (rabid?) Linux user. Preferred flavor: Arch

PTTG??

  • Bay Watcher
  • Kringrus! Babak crulurg tingra!
    • View Profile
    • http://www.nowherepublishing.com
Re: Don't Capitalize main()
« Reply #9 on: June 01, 2009, 07:59:09 pm »

In C++ it will fail to compile, but throws an error that will send you digging through code for hours. Naturally, while other errors can tell you what line they are on, if the compiler can't find main() (even though it CAN find Main(), it just doesn't know what to do with it), it doesn't know where the problem is.
Logged
A thousand million pool balls made from precious metals, covered in beef stock.

Rysith

  • Bay Watcher
    • View Profile
Re: Don't Capitalize main()
« Reply #10 on: June 01, 2009, 08:57:08 pm »

java is limited to 68 megabytes of memory.

This is blatantly false. I've run Java programs in 3GB heaps for fun. 32-bit Java is restricted to 1.5GB of memory or so, but as long as you're running on a 64-bit machine you have, for all practical purposes, no limit on how much memory you can use.

Now, default heap size used to be (a long, long, time ago) 64mb, which coupled with the non-heap parts would be about 68MB. But blaming the default heap sizes for your out of memory errors is just stupid.
Logged
Lanternwebs: a community fort
Try my orc mod!
The OP deserves the violent Dwarven equivalent of the Nobel Peace Prize.

SolarShado

  • Bay Watcher
  • Psi-Blade => Your Back
    • View Profile
Re: Don't Capitalize main()
« Reply #11 on: June 01, 2009, 09:02:22 pm »

java is limited to 68 megabytes of memory.

This is blatantly false.
Good to hear.
I've run Java programs in 3GB heaps for fun.
0_o I once made a program that'd recurse infinately, for fun. Got a StackOveflowException.
Logged
Avid (rabid?) Linux user. Preferred flavor: Arch

Dasleah

  • Bay Watcher
    • View Profile
Re: Don't Capitalize main()
« Reply #12 on: June 02, 2009, 05:00:45 am »

Code: [Select]
def MAiN():
     print "Python <3"

MAiN()
Logged
Pokethulhu Orange: UPDATE 25
The Roguelike Development Megathread.

As well, all the posts i've seen you make are flame posts, barely if at all constructive.

Muz

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

Don't write Main()?

Heck, I know some people who use variables called x,y,z,X,y2, znew, z_, Z, ZZ...

Those people should be banned from programming.
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.

Duke 2.0

  • Bay Watcher
  • [CONQUISTADOR:BIRD]
    • View Profile
Re: Don't Capitalize main()
« Reply #14 on: June 02, 2009, 10:04:27 am »

 Well, the x and y variables are allowed for learning a language and programs small enough that you can read the entirety of the code in five minutes. Now if a program gets beyond a small test of a concept, then you can start complaining.
Logged
Buck up friendo, we're all on the level here.
I would bet money Andrew has edited things retroactively, except I can't prove anything because it was edited retroactively.
MIERDO MILLAS DE VIBORAS FURIOSAS PARA ESTRANGULARTE MUERTO
Pages: [1] 2 3 4