Started a presentation

21 views
Skip to first unread message

Antóin Óg Ó Cuinneagáin

unread,
Oct 4, 2011, 12:29:13 PM10/4/11
to 091labs-code
Very basic and the going is slow but will get there eventually

Duncan Thomas

unread,
Oct 4, 2011, 12:43:05 PM10/4/11
to 091lab...@googlegroups.com
A link I usually pass around when looking at why main is 'int main(int
argc, char *argv[])'
http://users.aber.ac.uk/auj/voidmain.shtml

I've also a rant on why casting the return value of malloc is always
the wrong thing to do somewhere, which I'll try to dig out

2011/10/4 Antóin Óg Ó Cuinneagáin <anthony.c...@gmail.com>:


> Very basic and the going is slow but will get there eventually
> https://docs.google.com/present/edit?id=0AZNgFR-wWJahYWpnbnp0ZGo5OHc0XzQwZnFwcXZ6Z3Q&hl=en_US
>

--
Duncan Thomas

Antóin Óg Ó Cuinneagáin

unread,
Oct 4, 2011, 1:01:31 PM10/4/11
to 091lab...@googlegroups.com
My next slide was gonna be solving all the warnings and moving forward
with the default 'template' of

#include <stdio.h>

int main(){
  return 0; //for success
}

No nasty non standard from me I assure you :-)

Duncan Thomas

unread,
Oct 4, 2011, 1:21:00 PM10/4/11
to 091lab...@googlegroups.com
While it isn't /categorically required/ by the standard, it is
generally good practice to use

int main(void)

or

int main(int argc, char *argv[])

not

int main()


refs:
http://stackoverflow.com/questions/1765686/correctly-declaring-the-main-function-in-ansi-c
http://c-faq.com/ansi/maindecl.html
http://c-faq.com/ansi/voidmain.pjp.html
http://www.eskimo.com/~scs/readings/voidmain.960823.html

2011/10/4 Antóin Óg Ó Cuinneagáin <anthony.c...@gmail.com>:
> My next slide was gonna be solving all the warnings and moving forward
> with the default 'template' of
>
> #include <stdio.h>
>
> int main(){
>   return 0; //for success
> }
>
> No nasty non standard from me I assure you :-)
>
> On Tue, Oct 4, 2011 at 5:43 PM, Duncan Thomas <duncan...@gmail.com> wrote:
>>
>> A link I usually pass around when looking at why main is 'int main(int
>> argc, char *argv[])'
>> http://users.aber.ac.uk/auj/voidmain.shtml
>>
>> I've also a rant on why casting the return value of malloc is always
>> the wrong thing to do somewhere, which I'll try to dig out
>>
>> 2011/10/4 Antóin Óg Ó Cuinneagáin <anthony.c...@gmail.com>:
>> > Very basic and the going is slow but will get there eventually
>> > https://docs.google.com/present/edit?id=0AZNgFR-wWJahYWpnbnp0ZGo5OHc0XzQwZnFwcXZ6Z3Q&hl=en_US
>> >
>>
>>
>>
>> --
>> Duncan Thomas
>

--
Duncan Thomas

Reply all
Reply to author
Forward
0 new messages