C中使用_start()是什么?(What is the use of _start() in C?)
从我的同事那里得知,可以编写和执行一个C程序,而无需编写一个
main()
函数。 它可以做到下面withoutMain.c
// Compile it with gcc -nostartfiles void _start() { int ret = my_main(); exit(ret); } int my_main() { puts("This is a program without main!\n"); return 0; }
编译为:
gcc -o withoutMain withoutMain.c –nostartfiles
运行它:
./ withoutMain
我的问题是什么时候需要做这样的事情? 一些现实世界的场景?
I learned from my colleague that one can write and execute a C program without writing a
main()
function. It can be done like this:
my_main.c
/* Compile this with gcc -nostartfiles */ #include <stdlib.h> void _start() { int ret = my_main(); exit(ret); } int my_main() { puts("This is a program without a main() function!"); return 0; }
Compile it with this command:
gcc -o my_main my_main.c –nostartfiles
Run it with this command:
./my_main
When would one need to do this kind of thing? Is there any real world scenario where this would be useful?
原文:https://stackoverflow.com/questions/29694564
最满意答案
从GitHub支持,2014-06-07:
目前不可能手动触发重建,而不会将提交推送到相应的分支。
编辑:
正如Andy在评论中指出的那样,您可以使用以下命令推送一个空提交:
git commit -m 'rebuild pages' --allow-empty
From GitHub support, 2014-06-07:
It's not currently possible to manually trigger a rebuild, without pushing a commit to the appropriate branch.
Edit:
As Andy pointed out in the comments, you can push an empty commit with the command:
git commit -m 'rebuild pages' --allow-empty git push origin <branch-name>
相关问答
更多-
Middleman和Github的页面(Middleman and Github pages)[2022-05-20]
看起来这个宝石提供了一个优雅的解决方案: 中间人-GH-页 Looks like this gem provides an elegant solution: middleman-gh-pages -
Github页面缺少子模块?(Github pages missing submodule?)[2022-12-24]
这在“ 页面构建失败:缺少子模块 ”中提到。 您可以看到子模块是否初始化为: cd /path/to/main/repo git submodule init git submodule update 但是如果你没有任何.gitmodules,那么它实际上是一个嵌套的git仓库,你需要先删除那个项目(如果你真的需要它),把它作为一个合适的子模块 cd /path/to/main/repo git rm mysubmodule # no trailing slash git submodule add ... -
要更好地控制您的网站的缓存,您可以使用HTML5缓存清单。 看到: HTML5 应用缓存使用入门指南 在Mozilla开发人员网络上使用应用程序缓存 在维基百科上的HTML5缓存清单 离线Web应用程序 W3C工作组注释 离线Web应用程序在WHATWG 您可以使用window.applicationCache.swapCache()来更新网站的缓存版本,而无需手动重新加载页面。 这是HTML5 Rocks的代码示例,解释如何将用户更新到您网站的最新版本: // Check if a new cache i ...
-
从GitHub支持,2014-06-07: 目前不可能手动触发重建,而不会将提交推送到相应的分支。 编辑: 正如Andy在评论中指出的那样,您可以使用以下命令推送一个空提交: git commit -m 'rebuild pages' --allow-empty From GitHub support, 2014-06-07: It's not currently possible to manually trigger a rebuild, without pushing a commit to the ...
-
有一个github-pages gradle插件 ,非常容易用于在gradle构建中向gh-pages分支发布文档,我过去成功使用过它。 There's a github-pages gradle plugin that is extremely easy to use to publish documentation to gh-pages branch in gradle builds and I've successfully used it in the past.
-
找到了答案 - https://github.com/blog/572-bypassing-jekyll-on-github-pages 只需要在回购中包含一个.nojekyll文件 Found an answer -https://github.com/blog/572-bypassing-jekyll-on-github-pages Just needed to include a .nojekyll file in the repo
-
“石板”主题只有一个“默认”布局。 所以切换到layout: default解决了问题。 The "slate" theme only has a "default" layout. So switching to layout: default fixed the issues.
-
对于本地构建,您必须使用bundle update来更新gem。 你会看到你有一个'荧光笔'警告。 关于github-pages。 我只是分叉你的回购 ,它只用相同的突出显示警告构建 (只需很小的修改): 页面构建成功完成,但返回以下警告:您正在尝试使用'pygments'荧光笔,目前GitHub页面上不支持该荧光笔。 您的网站将使用“rouge”代替突出显示。 要取消此警告,请在“_config.yml”中将“highlighter”值更改为“rouge”,并确保未设置“pygments”键。 有关更多信 ...
-
Github页面不再构建(Github Pages No Longer Builds)[2023-06-02]
我无法弄清楚为什么github页面突然无法构建这个模板,但我找到了一个解决方法,通过在本地编译页面并将其推送到github。 本文提供了有关如何使用此技术发布到github页面的分步指南。 基本上,您需要使用本地Rakefile中的以下脚本进行本地编译和推送: require "rubygems" require "tmpdir" require "bundler/setup" require "jekyll" # Change your GitHub reponame GITHUB_REPONAME ... -
每个Jekyll主题都有不同的布局。 默认主题有四种布局: 默认 家 页 岗位 虽然其他布局可以具有相同的布局或不同的布局集,但在这种情况下,您选择的其他主题只有一个布局,它尊重其名称的最小部分(jekyll-theme-minimal): 默认 默认安装附带了几个使用不同布局的示例,如果您更改为jekyll-theme-minimal ,则只有一个布局可用(除非您自己添加更多)。 Each Jekyll theme has a different set of layouts. The default t ...