惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
美团技术团队
腾讯CDC
V
V2EX
G
Google Developers Blog
博客园 - Franky
博客园 - 司徒正美
Stack Overflow Blog
Stack Overflow Blog
阮一峰的网络日志
阮一峰的网络日志
Microsoft Azure Blog
Microsoft Azure Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
罗磊的独立博客
C
Check Point Blog
MyScale Blog
MyScale Blog
aimingoo的专栏
aimingoo的专栏
F
Fortinet All Blogs
酷 壳 – CoolShell
酷 壳 – CoolShell
V2EX - 技术
V2EX - 技术
The Last Watchdog
The Last Watchdog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
有赞技术团队
有赞技术团队
Security Archives - TechRepublic
Security Archives - TechRepublic
S
Security @ Cisco Blogs
W
WeLiveSecurity
D
DataBreaches.Net
Forbes - Security
Forbes - Security
V
Visual Studio Blog
P
Proofpoint News Feed
S
Secure Thoughts
H
Help Net Security
Cloudbric
Cloudbric
云风的 BLOG
云风的 BLOG
Microsoft Security Blog
Microsoft Security Blog
N
News and Events Feed by Topic
Schneier on Security
Schneier on Security
Engineering at Meta
Engineering at Meta
Attack and Defense Labs
Attack and Defense Labs
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
S
Security Affairs
L
LangChain Blog
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
Hacker News: Ask HN
Hacker News: Ask HN
H
Heimdal Security Blog
M
MIT News - Artificial intelligence
The Register - Security
The Register - Security

RisingIce

2024年终总结 | RisingIce 使用大模型总结B站视频 | RisingIce 使用Vercel搭建Umami统计 | RisingIce 部署Twikoo评论系统 | RisingIce Vercel域名被墙的问题 | RisingIce 修改anzhiyu主题的TianliGPT插件为其他大模型API | RisingIce Ubuntu挂载群晖共享文件夹与Comfyui模型迁移 | RisingIce 记一次conda环境激活却不起作用的问题及解决方法 | RisingIce 《程序员的README》- 随笔 | RisingIce
Hello Word的由来 | RisingIce
RisingIce · 2023-12-10 · via RisingIce

一、前言 ​

还记得大一刚学编程的时候,学的第一门语言是C语言,print出的第一行代码是Hello World。现在想起来记忆已经有些模糊,只记得当时配置好环境之后,跟着老师一个字母一个字母的输入进去,点击运行之后,cmd窗口弹出,第一行就是Hello World,当时忙于惊叹于计算机编程之神奇带给我的冲击,并没有细想为什么是Hello World,老师也没有过多解释。今天周末闲来无事,就去翻找了一下Wiki以及其他资料,在此做一个总结报告记录一下。

二、Hello World 的由来 ​

Hello World 最早可追溯至1973Brian Kernighan 撰写的一份内部的技术文件《A Tutorial Introduction to the Language B》中的一个示例程序:

bash

main( ) {
    extern a, b, c;
    putchar(a); putchar(b); putchar(c); putchar('!*n');
}
 
a 'hell';
b 'o, w';
c 'orld';

但让其广为流传的是1978年由Brian Kernighan 和C 语言之父 - Dennis M. Ritchie 合著的C程序设计语言,它是第一部介绍C语言编程方法的书籍,书中用"hello,world"为示例开始讲解程序设计:

在示例中,main( )函数定义了程序开始执行的位置。其主体由一条语句组成,即对printf函数的调用,意思是“打印格式化”(print formatted)。这个函数将使程序输出以参数传递给它的任何内容,在本例中是字符串hello, world。

▲布莱恩·柯尼汉在1978年用C语言手写的hello,world程序以及他个人的亲笔签名,图片来源于wiki

随着这部经典著作的大卖,"hello, world"也流行起来,逐渐成为具有特定象征意义的文化符号。

e40d54c637b88d0a5417fe82ad21a3a5.jpege40d54c637b88d0a5417fe82ad21a3a5.jpeg

▲年轻时的布莱恩·柯尼汉,图片来源网络

但是非常遗憾的是,当 Forbes India 杂志在2011年采访他的时候,他自己对这段传奇故事中一些记忆已经有点儿模糊了。当他被问及关于“hello,world”的准确来历时,他是回答时说:

我只记得,我好像看过一幅漫画,讲述一枚鸡蛋和一只小鸡的故事,在那副漫画中,小鸡说了一句 ‘Hello World’

三、目前一些流行语言的Hello World ​

Java

java

class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, world!");
    }
}

Python

Python

print("Hello, World!")

C#

c#

using System;

class Program {
    static void Main(string[] args) {
        Console.WriteLine("Hello, World!");
    }
}

C++

c++

#include <iostream>

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}

Ruby


Go

go

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

Kotlin

kotlin

fun main() {
    println("Hello, World!")
}

Rust

rust

fn main() {
    println!("Hello, World!");
}

PHP

php

<?php
echo "Hello, World!";
?>

TypeScript

typescript

console.log("Hello, World!");

Scala

scala

object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello, World!")
  }
}

Erlang

erlang

io:format("Hello, World!~n").