Skip to content
  • 卜部昌平's avatar
    83c52192
    * main.c: <stdlib.h> is needed, to introduce the getenv(3) · 83c52192
    卜部昌平 authored
      prototype declaration.  Without it a C compiler shall infer
      the getenv type as "int getenv(...);", but this is totally
      wrong, especially when your machine's sizeof(int) and
      sizeof(char*) differs.  On such environment a return value
      of getenv(3), which is in fact a char*, might first casted
      into a int (loses data here), and then casted back to char*
      by automatic integral promotion fo fit to the prototype of
      ruby_set_debug_option().
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
    83c52192
    * main.c: <stdlib.h> is needed, to introduce the getenv(3)
    卜部昌平 authored
      prototype declaration.  Without it a C compiler shall infer
      the getenv type as "int getenv(...);", but this is totally
      wrong, especially when your machine's sizeof(int) and
      sizeof(char*) differs.  On such environment a return value
      of getenv(3), which is in fact a char*, might first casted
      into a int (loses data here), and then casted back to char*
      by automatic integral promotion fo fit to the prototype of
      ruby_set_debug_option().
    
    
    git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Loading