Browse Source

better wrapping of main C function

  Thanks to Dov Grobgeld for pointing out this fix.

* lisp/ob-C.el (org-babel-C-ensure-main-wrap): Add an explicit return
  to automatically generated main methods.
Eric Schulte 13 years ago
parent
commit
6c1b38182b
1 changed files with 1 additions and 1 deletions
  1. 1 1
      lisp/ob-C.el

+ 1 - 1
lisp/ob-C.el

@@ -152,7 +152,7 @@ it's header arguments."
   "Wrap body in a \"main\" function call if none exists."
   (if (string-match "^[ \t]*[intvod]+[ \t\n\r]*main[ \t]*(.*)" body)
       body
-    (format "int main() {\n%s\n}\n" body)))
+    (format "int main() {\n%s\nreturn(0);\n}\n" body)))
 
 (defun org-babel-prep-session:C (session params)
   "This function does nothing as C is a compiled language with no