1. 程式人生 > >幾乎所有程式語言的hello, world程式(1)

幾乎所有程式語言的hello, world程式(1)

簡介

“hello, world”程式是指在電腦螢幕上列印/輸出”hello, world”這行字串的應用程式。該範例最早出自1972年由貝爾實驗室成員布萊恩柯林漢撰寫的內部技術檔案”A Tutorial Introduction to the Language B”中,不久同作者於1974年所寫的”Programming in C: A Tutorial”也使用了這個範例,而以本文件所改寫的《C語言程式設計》也保留了這個範例。

但是需要注意的是,Hello World的標準程式是”hello, world”,沒有雙引號和驚歎號,全部小寫,並且在逗號後留有空格。

雖然都來自網路……但排版了好久好久好久……………………

1C-Enterprise

Message("Hello, World!");

4Test

testcase printHelloWorld()
    print("Hello World!")

ABAP4

REPORT ZHB00001.
*Hello world in ABAP/4 *
WRITE: 'Hello world'.

ACPI Source Language

Scope(\) {
    Method(_WAK) {
        Store ("Hello World", Debug)
        Return(Package(2
)
{0x00000000,0})
} }

Action!

PROC Main()
 PrintE("Hello World!")
RETURN

ActionScript 3.0

var t:TextField=new TextField();
t.text="Hello World!";
addChild(t);

Actionscript-Flash5

trace ("Hello World"); 

ActionScript-Flash8

class HelloWorld
{
    private var helloWorldField:TextField;

    public
function HelloWorld( mc:MovieClip ) { mc.helloWorldField = mc.createTextField("helloWorldField", mc.getNextHighestDepth(), 0, 0, 100, 100); mc.helloWorldField.autoSize = "left"; mc.helloWorldField.html = true; mc.helloWorldField.htmlText = '<font size="20" color="#0000FF">Hello World!</font>'; } } // on a frame import HelloWorld; var hw:HelloWorld = new HelloWorld( this );

Actionscript-FlashMX

// Hello World in Actionscript (Flash MX onwards) 

_root.createTextField("mytext",1,100,100,300,100);
mytext.multiline = true;
mytext.wordWrap = true;
mytext.border = false;

myformat = new TextFormat();
myformat.color = 0xff0000;
myformat.bullet = false;
myformat.underline = true;

mytext.text = "Hello World!";
mytext.setTextFormat(myformat);

Ada

-- Hello World in Ada

with Text_IO;
procedure Hello_World is

begin
  Text_IO.Put_Line("Hello World!");
end Hello_World;

ADVPL

// Hello World in ADVPL

User Function Hello()
Local cMsg := "Hello, world!"
conout(cMsg)
MsgInfo(cMsg)
Return

Algol-60

'BEGIN'
   'COMMENT' Hello World in Algol 60;
    OUTPUT(4,'(''('Hello World!')',/')')
'END'

Algol-68

( # Hello World in Algol 68 # print(("Hello World!",newline)))

Alpha-Five-Xbasic

' Hello World in Alpha Five Xbasic

ui_msg_box("The 'Hello World' Collection", "Hello World", UI_ATTENTION_SYMBOL)

amharic


// Hello World in Clipper

? "Hello World"

Amiga-E

-> Hello World in Amiga-E 
PROC main() IS WriteF('Hello World\n')

AMOS

Back to index 
Rem Hello world in AMOS

Print "Hello world!"

AngelScript

// Hello world in AngelScript

void main() { print("Hello world\n"); }

Ante

98♥J♦A237♠J♦A7♦J♦J♦A3♦J♦564♥J♥A66♠J♥A8♦J♦A8♠J♦A3♦J♦A6♠J♦A8♠J♦A32♠J♥A26♠J♥

APC

// Hello World in the APC language for probes

probe program
{
    on_entry log ("Hello, world!\n");
}

APL

⍝ Hello World in APL

⎕←\'Hello World\'

AppleScript

-- "Hello World" in AppleScript:

display dialog "Hello World"

Arena

// Hello world in Arena

print("Hello World!");

Argh!

Hello World in Argh!. No comment character exists.

j       world
lppppppPPPPPPsrfj
 hello,      *  j
              qPh

ArnoldC

IT'S SHOWTIME
TALK TO THE HAND "Hello World"
YOU HAVE BEEN TERMINATED

ASP-CSharp

<!-- Hello World for ASP.NET using C# -->
<% @ Page Language="C#" %>
<% ="Hello World!" %>

ASP-JavaScript

<%@ language="javascript" %>
<html><body>
<%
Response.Write('Hello World!');
%>
</body></html>

ASP-VBE

<!-- Hello World in ASP-VBE (Visual Basic Script Encided) -->
<html>
<script language="VBScript.Encode">#@~^[email protected]#@&HdTAK6PrCsVKP    WMV[[email protected]#@&HwcAAA==^#[email protected]</script>
</html>

ASP-VBS

Hello World for Microsoft ASP (in VBScript)

<%@ language="vbscript" %>
<html><body>
<%
Response.write "Hello World!"
%>
</body></html>


ASP.NET

<!-- Hello World in ASP.NET -->
<%= "Hello World!" %>

Assembler-6502-AppleII

**********************************
*                                *
*      HELLO WORLD FOR 6502      *
*    APPLE ][, MERLIN ASSEMBLER  *
*                                *
**********************************

STROUT  EQU $DB3A ;OUTPUTS AY-POINTED NULL TERMINATED STRING
    LDY #>HELLO
    LDA #<HELLO
    JMP STROUT

HELLO   ASC "HELLO WORLD!",00

Assembler-6502-C64

; Hello World for 6502 Assembler (C64)

ldy #0
beq in
loop:
jsr $ffd2
iny
in:
lda hello,y
bne loop
rts
hello: .tx "Hello World!"
       .by 13,10,0


Assembler-68000-Amiga

; Hello World in 68000 Assembler for dos.library (Amiga)

        move.l  #DOS
        move.l  4.w,a6
        jsr     -$0198(a6)      ;OldOpenLibrary
        move.l  d0,a6
        beq.s   .Out
        move.l  #HelloWorld,d1

A)      moveq   #13,d2
        jsr     -$03AE(a6)      ;WriteChars

B)      jsr     -$03B4          ;PutStr

        move.l  a6,a1
        move.l  4.w,a6
        jsr     -$019E(a6)      ;CloseLibrary
.Out    rts

DOS          dc.b    'dos.library',0
HelloWorld   dc.b    'Hello World!',$A,0

Assembler-68000-AtariST

; Hello World in 68000 Assembler (Atari ST)

     move.l #helloworld,-(A7)
     move   #9,-(A7)
     trap   #1
     addq.l #6,A7
     move   #0,-(A7)
     trap   #1
helloworld:
     dc.b "Hello World!",$0d,$0a,0

Assembler-68008

; Hello World in 68008 Assembler (Sinclar QL)

     move.l #0,a0
     lea.l  mess,a1
     move.w $d0,a2
     jsr    (a2)
     rts
mess dc.w   12
     dc.b   'Hello World!',10
     end

Assembler-8051

-- Hello World in Assembler for the Intel 8051 (MSC51)

 Org 0

   mov dptr,#msg
   mov R0,#30h  
loop:
   clr a
   movc a,@a+dptr
   jz end
   mov @R0,a
   inc R0
   inc dptr
   sjmp  loop

end:
    jmp $

msg:
    db 'Hello World",0

Assembler-ARM

; Hello World in ARM code assembler, with RISC OS software interrupt

SWI "OS_WriteS"
EQUS "Hello World!"
EQUB 0
ALIGN
MOV PC,R14

Assembler-Darwin-PPC

; Hello World in Assembler for the Darwin Power-PC

.data
.cstring
.align 2
msg:
.asciz "Hello world!\n"
len = . - msg
.text
.align 2
.globl _start
_start:
li r0,4
li r3,1
lis r4,ha16(msg)
ori r4,r4,lo16(msg)
li r5,len
sc
li r0,1
li r3,0
sc

Assembler-DG-Nova

                        .TITL HELLO
02                      ; "HELLO, WORLD" FOR NOVA RUNNING RDOS
03                      ; USES PCHAR SYSTEM CALL
04                      .NREL
05                      .ENT START
06
07              START:
08 00000'022424 DOCHAR: LDA 0,@PMSG     ; LOAD AC0 WITH NEXT CHARACTER,
09 00001'101015         MOV# 0,0,SNR    ; TEST AC0;
10 00002'000412          JMP DONE ; SKIPPED IF NONZERO
11 00003'006017         .SYSTM
12 00004'010000         .PCHAR          ; PRINT FIRST
13 00005'000413          JMP ER ; SKIPPED IF OK
14 00006'101300         MOVS 0,0        ; SWAP BYTES
15 00007'006017         .SYSTM
16 00010'010000         .PCHAR          ; PRINT SECOND
17 00011'000407          JMP ER ; SKIPPED IF OK
18 00012'010412         ISZ PMSG        ; POINT TO NEXT WORD
19 00013'000765         JMP DOCHAR      ; GO AROUND AGAIN
20
21 00014'006017 DONE:   .SYSTM          ; NORMAL EXIT
22 00015'004400         .RTN
23 00016'000402          JMP ER
24 00017'063077         HALT
25 00020'006017 ER:     .SYSTM          ; ERROR EXIT
26 00021'006400         .ERTN
27 00022'063077          HALT
28 00023'063077         HALT
29
30 00024'000025'PMSG:   .+1     ; ADDRESS OF FIRST WORD OF TEXT
31                      ; NOTE BYTES ARE PACKED RIGHT-TO-LEFT BY DEFAULT
32 00025'042510         .TXT /HELLO, WORLD!<15><12>/ ; THAT'S CR LF
33       046114
34       026117
35       053440
36       051117
37       042114
38       006441
39       000012
40 00035'000000         0 ; FLAG WORD TO END STRING
41
42                      .END START

Assembler-HLA

; Hello World for Intel compatible High Level Assembler

program HELLO;
       #include( "stdlib.hhf" );
begin HELLO;
       stdout.put("Hello World",nl);
end HELLO;

Assembler-IBM-370

ITLE 'Hello World for IBM Assembler/370 (VM/CMS)'
HELLO    START
BALR  12,0
USING *,12
*
WRTERM 'Hello World!'
*
SR    15,15
BR    14
*
END   HELLO

Assembler-Intel

; Hello World for Intel Assembler (MSDOS)

mov ax,cs
mov ds,ax
mov ah,9
mov dx, offset Hello
int 21h
xor ax,ax
int 21h

Hello:
  db "Hello World!",13,10,"$"

Assembler-Itanium

/* Hello world for IA64 (Itanium) Assembly */

.HW:
        stringz "Hello World"
        .text
        .align 16
        .global main#
        .proc main#
main:
        .prologue 14, 32
        .save ar.pfs, r33
        alloc r33 = ar.pfs, 0, 4, 1, 0
        .vframe r34
        mov r34 = r12
        adds r12 = -16, r12
        mov r35 = r1
        .save rp, r32
        mov r32 = b0
        .body
        addl r14 = @ltoffx(.HW), r1
        ;;
        ld8.mov r14 = [r14], .HW
        ;;
        st8 [r34] = r14
        ld8 r36 = [r34]
        br.call.sptk.many b0 = puts#
        mov r1 = r35
        ;;
        mov ar.pfs = r33
        mov b0 = r32
        .restore sp
        mov r12 = r34
        br.ret.sptk.many b0

Assembler-Linux

    ;; Hello World for the nasm Assembler (Linux)

    SECTION .data

    msg db  "Hello, world!",0xa ; 
    len equ     $ - msg

    SECTION .text
    global main

main:
        mov     eax,4       ; write system call
        mov     ebx,1           ; file (stdou)
        mov     ecx,msg         ; string
        mov     edx,len         ; strlen
    int     0x80        ; call kernel

    mov eax,1       ; exit system call
        mov     ebx,0      
        int     0x80        ; call kernel

Assembler-MIPS

.globl main

main:   jal hwbody              #call Hello Word Procedure
       trap 10                 #exit

hwbody: addi $30, $30,-4        #we need to preserve
       sw $4, 0($30)           #existing values in register 4

       addi $4,$0,72           # H
       trap 101
       addi $4,$0,101          # e
       trap 101
       addi $4,$0,108          # l
       trap 101
       trap 101                # l
       addi $4,$0,111          # o
       trap 101
       addi $4,$0,32           # <space>
       trap 101
       addi $4,$0,87           # W
       trap 101
       addi $4,$0,111          # o
       trap 101
       addi $4,$0,114          # r
       trap 101
       addi $4,$0,108          # l
       trap 101
       addi $4,$0,100          # d
       trap 101
       addi $4,$0,33           # !
       trap 101
       addi $4,$0,10           # \n
       trap 101

done:   lw $4, 0($30)           #restore values
       addi $30, $30, 4        #in register 4
       jr $31                  #return to the main

Assembler-MMIX

*   Hello World in Assembler 
*   for the MMIX Computer 

       LOC   #100
Main   GETA  $255,String
       TRAP  0,Fputs,StdOut
       TRAP  0,Halt,0
String BYTE  "Hello, world!",#a,0

Assembler-PA-RISC

// Hello World written in PA-RISC 2.0 assembly code

    .LEVEL  2.0N

    .SPACE  $TEXT$,SORT=8
    .SUBSPA $CODE$,QUAD=0,ALIGN=4,ACCESS=0x2c,CODE_ONLY,SORT=24
main
    .PROC
    .CALLINFO CALLER,FRAME=16,SAVE_RP,ORDERING_AWARE
        .ENTRY
        STW     %r2,-20(%r30)   ;offset 0x0
        LDO     64(%r30),%r30   ;offset 0x4
        ADDIL   LR'M$3-$global$,%r27,%r1        ;offset 0x8
        LDO     RR'M$3-$global$(%r1),%r1        ;offset 0xc
        STW     %r1,-56(%r30)   ;offset 0x10
        ADDIL   LR'M$3-$global$+16,%r27,%r1     ;offset 0x14
        LDO     RR'M$3-$global$+16(%r1),%r26    ;offset 0x18
        LDW     -56(%r30),%r25  ;offset 0x1c
        LDIL    L'printf,%r31   ;offset 0x20
        .CALL   ARGW0=GR,ARGW1=GR,RTNVAL=GR     ;in=25,26;out=28;
        BE,L    R'printf(%sr4,%r31),%r31        ;offset 0x24
        COPY    %r31,%r2        ;offset 0x28
        LDW     -84(%r30),%r2   ;offset 0x2c
        BVE     (%r2)   ;offset 0x30
        .EXIT
        LDO     -64(%r30),%r30  ;offset 0x34
    .PROCEND    ;


    .SPACE  $TEXT$
    .SUBSPA $CODE$
    .SPACE  $PRIVATE$,SORT=16
    .SUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=0x1f,SORT=16
M$3
    .ALIGN  8
    .STRINGZ    "Hello World"
    .BLOCK  4
    .STRINGZ    "%s\n"
    .IMPORT $global$,DATA
    .SPACE  $TEXT$
    .SUBSPA $CODE$
    .EXPORT main,ENTRY,PRIV_LEV=3,LONG_RETURN
    .IMPORT printf,CODE
    .END

Assembler-PDP11

;       Hello World in Assembler for the DEC PDP-11 with the
;   RSX-11M-PLUS operating system
;
        .title Hello
        .ident /V0001A/
        .mcall qiow$s, exit$s
        .psect $code,ro,i
start:  qiow$s #5,#5,,,,<#str, #len, #40>
        exit$s
        .psect $data,ro,d
str:    .ascii / Hello World!/
        len=.-str
        .end start

Assembler-PDP8

/ Hello World in Assembler for the DEC PDP-8
*200
hello,    cla cll
        tls            / tls to set printer flag.
        tad charac    / set up index register
        dca ir1        / for getting characters.
        tad m6        / set up counter for
        dca count    / typing characters.
next,    tad i ir1    / get a character.
        jms type    / type it.
        isz count    / done yet?
        jmp next    / no: type another.
        hlt

type,    0            / type subroutine
        tsf
        jmp .-1
        tls
        cla
        jmp i type
charac,    .            / used as initial value of ir1
        310 / H
        305 / E
        314 / L
        314 / L
        317 / O
        254 / ,
        240 /
        327 / W
        317 / O
        322 / R
        314 / L
        304 / D
        241 / !
m6,        -15
count,    0
ir1 = 10
$

Assembler-VP


; Hello World in VP Assembler for intent (Amiga Anywhere)

.include 'tao'

tool 'home/hello',VP,TF_MAIN,8192,0
    ent (-:-)
        qcall lib/print,(hello_world.p : i~)
        ret ()
    entend

    data

hello_world:
    dc.b "Hello World!",ASCII_LF,0

toolend

Assembler-Win32


; Hello world in Assembler for the Win32 architecture

TITLE Hello world in win32. Tasm

VERSION T310
Model use32 Flat,StdCall

start_code segment byte public 'code' use32
begin:
 Call MessageBox, 0, offset sHallo, offset caption, 0
 Call ExitProcess, 0
start_code Ends

start_data segment byte public 'data' use32

sHallo  db 'Hello world',0
caption db "Hi",0

start_data Ends
End begin

Assembler-z390

; Hello World for z390 IBM compatible mainframe assembler

HELLO CSECT
     USING *,15
     WTO 'Hello World'
     BR 14
     END

Assembler-Z80-Console

; This is a "Hello World" program for Z80 and TMS9918 / TMS9928 / TMS9929 /
; V9938 or V9958 VDP.
; That means that this should work on SVI, MSX, Colecovision, Memotech,
; and many other Z80 based home computers or game consoles.
;
; Because we don't know what system is used, we don't know where RAM
; is, so we can't use stack in this program.
;
; This version of Hello World was written by Timo "NYYRIKKI" Soilamaa
; 17.10.2001
;
;----------------------------------------------------------------------
; Configure this part:

DATAP: EQU #98 ; VDP Data port #98 works on all MSX models
; (TMS9918/TMS9929/V9938 or V9958)
; #80 works on SVI 
; (for other platforms you have to figure this out by your self)

CMDP: EQU #99 ; VDP Command port #99 works on all MSX models
; (TMS9918/TMS9929/V9938 or V9958)
; #81 works on SVI
; (for other platforms you have to figure this out by your self)
;-----------------------------------------------------------------------
; Program starts here:

ORG 0 ; Z80 starts always from here when power is turned on
DI ; We don't know, how interrupts works in this system, so we disable them.

; Let's set VDP write address to #0000
XOR A
OUT (CMDP),A
LD A,#40
OUT (CMDP),A

; Now let's clear first 16Kb of VDP memory
LD B,0
LD HL,#3FFF
LD C,DATAP
CLEAR:
OUT (C),B
DEC HL
LD A,H
OR L
NOP ; Let's wait 8 clock cycles just in case VDP is not quick enough.
NOP
JR NZ,CLEAR

; Now it is time to set up VDP registers:
;----------------------------------------
; Register 0 to #0
;
; Set mode selection bit M3 (maybe also M4 & M5) to zero and 
; disable external video & horizontal interrupt
LD C,CMDP
LD E,#80

OUT (C),A
OUT (C),E
;---------------------------------------- 
; Register 1 to #50
;
; Select 40 column mode, enable screen and disable vertical interrupt

LD A,#50
INC E
OUT (C),A
OUT (C),E
;---------------------------------------- 
; Register 2 to #0
;
; Set pattern name table to #0000

XOR A
INC E
OUT (C),A
OUT (C),E
;---------------------------------------- 
; Register 3 is ignored as 40 column mode does not need color table
;
INC E
;---------------------------------------- 
; Register 4 to #1
; Set pattern generator table to #800

INC A
INC E

OUT (C),A
OUT (C),E
;---------------------------------------- 
; Registers 5 (Sprite attribute) & 6 (Sprite pattern) are ignored 
; as 40 column mode does not have sprites

INC E
INC E
;---------------------------------------- 
; Register 7 to #F0
; Set colors to white on black

LD A,#F0
INC E
OUT (C),A
OUT (C),E
;----------------------------------------

; Let's set VDP write address to #808 so, that we can write
; character set to memory
; (No need to write SPACE it is clear char already)
LD A,8
OUT (C),A
LD A,#48
OUT (C),A

; Let's copy character set
LD HL,CHARS
LD B, CHARS_END-CHARS
COPYCHARS:
LD A,(HL)
OUT (DATAP),A
INC HL
NOP ; Let's wait 8 clock cycles just in case VDP is not quick enough.
NOP
DJNZ COPYCHARS

; Let's set write address to start of name table
XOR A
OUT (C),A
LD A,#40
OUT (C),A

; Let's put characters to screen
LD HL,ORDER
LD B,ORDER_END-ORDER
COPYORDER:
LD A,(HL)
OUT (DATAP),A
INC HL

JR OVERNMI
NOP
NOP

; Here is address #66, that is entry for NMI
RETN ;Return from NMI

OVERNMI:
DJNZ COPYORDER

; The end
HALT

; Character set:
; --------------
ORDER:
DEFB 1,2,3,3,4,0,5,4,6,3,7
ORDER_END:

CHARS:

; H
DEFB %10001000
DEFB %10001000
DEFB %10001000
DEFB %11111000
DEFB %10001000
DEFB %10001000
DEFB %10001000
DEFB %00000000
; e
DEFB %00000000
DEFB %00000000
DEFB %01110000
DEFB %10001000
DEFB %11111000
DEFB %10000000
DEFB %01110000
DEFB %00000000
; l
DEFB %01100000
DEFB %00100000
DEFB %00100000
DEFB %00100000
DEFB %00100000
DEFB %00100000
DEFB %01110000
DEFB %00000000
; o
DEFB %00000000
DEFB %00000000
DEFB %01110000
DEFB %10001000
DEFB %10001000
DEFB %10001000
DEFB %01110000
DEFB %00000000
; W
DEFB %10001000
DEFB %10001000
DEFB %10001000
DEFB %10101000
DEFB %10101000
DEFB %11011000
DEFB %10001000
DEFB %00000000

; r
DEFB %00000000
DEFB %00000000
DEFB %10110000
DEFB %11001000
DEFB %10000000
DEFB %10000000
DEFB %10000000
DEFB %00000000
; d
DEFB %00001000
DEFB %00001000
DEFB %01101000
DEFB %10011000
DEFB %10001000
DEFB %10011000
DEFB %01101000
DEFB %00000000
chars_end:

Assembler-ZX81


; Hello World in Assembler for the ZX81 (Zilog Z80)

          CALL SPRINT
          DEFM HELLO WORLD.
          DEFB FF
          RET
SPRINT    POP HL
          LD A,(HL)
          INC HL
          PUSH HL
          CP FF
          RET Z
          CALL PRINT
          JR SPRINT

Asterisk


;; Hello world in Asterisk

exten => s,1,NoOp(Hello World)

ATS

// Hello world in ATS

implement main () = begin
  print ("Hello, world!"); print_newline ()
end

AutoHotkey


; Hello World in AutoHotkey

Msgbox Hello, World!
AutoIT3 

;Hello, World for AutoIT3  http://www.autoitscript.com

msgbox(0,"Hello World",0)

AviSynth

# Hello World for AviSynth video editor
BlankClip()
Subtitle("Hello, world!")

AWK



# Hello world in AWK

BEGIN {
  print "Hello World!"
}

B


/* Hello World in B */

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

a 'hell' ;
b 'o, w' ;
c 'orld' ;

BAL


Hello World in IBM mainframe Basic Assembler Language (BAL)

HELLO    CSECT
         STM   R14,R12,12(R13)
         LR    R12,R15
         USING HELLO,R12
         LA    R10,SAVEAREA
         ST    R13,4(R10)
         ST    R10,8(R13)
         LR    R13,R10
*
         WTO   'HELLO WORLD',ROUTCDE=1
*
         L     R13,4(R13)
         LM    R14,R12,12(R13)
         SR    R15,R15
         BCR   B'1111',R14
*
SAVEAREA DS    18F
         LTORG
R0       EQU   0
R1       EQU   1
R2       EQU   2
R3       EQU   3
R4       EQU   4
R5       EQU   
            
           

相關推薦

建立一門新的程式語言-Flex&Bison教程-1-初探

之前一直想鑽研一下這方面的東西,於是便花了一些精力研究這些相關的工具和技術,現在我把我總結的一些經驗分享給大家 Flex & Bison 是比較有名而且易用的parser組合,今後的工作大體都用到了這兩個工具。他們可以在gnu官網下載,windows使用者要麼去下載

程式語言的底層描述1——彙編基礎概念的開始之入門

該主題預設在類unix作業系統中進行討論 gcc編譯器可通過不同的引數,生成不同階段的編譯檔案,比如,我們想生成可執行檔案,就用gcc -o;要生成目的碼.o,就用gcc -c;要生成彙編程式碼.s,就用gcc -S, 程式編譯的順序是,編譯器先根據.c原始檔產生.s彙編

CUDA入門——環境搭建,hello world cuda1

環境搭建 一般而言,CUDA程式的基本模式是: 分配記憶體空間和視訊記憶體空間 初始化記憶體空間 將要計算的資料從記憶體上覆制到視訊記憶體上 執行kernel計算 將計算後視訊記憶體上的資料複製到記憶體上 處理複製到記憶體上的資料 // This is th

6個變態的C語言HELLO WORLD程式

下面的六個程式片段主要完成這些事情: 輸出Hello, World混亂C語言的原始碼 下面的所有程式都可以在GCC下編譯通過,只有最後一個需要動用C++的編譯器g++才能程式設計通過。 hello1.c #define _________ } #defin

程式語言的底層描述2——棧指標esp和幀指標ebp

程式語言的底層描述(2)——棧指標esp和幀指標ebp 2014年10月11日 17:43:57 coreyspomu 閱讀數:3062更多 個人分類: 資訊標識和處理 本節我們重點討論棧指標esp和幀指標ebp,圍繞這兩個重要的暫存器,推匯出函式棧幀結構。

程式語言學習 2 】轉發雜湊表散列表原理詳解

什麼是雜湊表?(其實就是把字元通過雜湊函式轉化為索引)    雜湊表(Hash table,也叫散列表),是根據關鍵碼值(Key value)而直接進行訪問的資料結構。也就是說,它通過把關鍵碼值對映到表中一個位置來訪問記錄,以加快查詢的速度。這個對映函式叫做雜湊函式

程式語言的底層描述4——遞迴函式彙編棧幀實現

這一節我們來討論遞迴函式棧幀實現。 一:mov和lea的含義和用法 在論述遞迴棧幀之前,回到第一節(1)中關於mov的闡述,說實話,就在寫這些文字之前,我以為自己理解了mov的含義,但是當看到lea操作時,大腦卻瞬間混亂,連之前認為熟練的mov也忽然打不到方向了。因此這裡

程式學習之路--UI1

button.wxss /* pages/button/button.wxss */ .container{ align-items: flex-start; justify-content:

簡易小程式複習C語法基礎1

#include<stdio.h> int main() { printf("Enter a number to sum:\n"); printf("Enter \"0\" if you want to quit.\n"); long su

一個屌絲程式設計師的感情線1

      博主09年7月畢業,算起來差不多9年半了,中間曲曲折折,技術說起來進步不大,所以也沒有什麼乾貨跟大家分享。接下來博主打算分享一下自己的感情線,練習一下自己寫部落格(吹牛逼)的能力。        為什麼分享下感情的

Windows應用程式打包成exe檔案1- 工具簡單總結

最近有對一個Windows應用程式少許維護和修改。修改之後要釋出新的exe安裝檔案,打包exe檔案時,遇到了很頭疼的問題,還好最後解決了,記錄一下。 Visual Studio版本:Visual Studio 2017 Visual Studio 201

微信小程式-自定義NavBar元件1

最近公司專案忙得不可開交,各種不可描述的事情,然後學習基本停機。這個週末沒出去浪,就在家把之前王夫人給我設計的小程式做了做,然後一步步分享做的過程中遇到的問題和積累,希望大家爬坑過程中能幫到一些吧 元件化 元件化本身是一個可以講的很大,也可以濃縮為

微信小程式實現動態新增標籤1

說明:最近入住微信小程式,將自己所學經歷分享出來,包括學到的知識,踩到的坑,一起分享給大家,後續會慢慢更新: 首先針對一些幾乎沒有基礎的童鞋,附上一些連結,大致看完後能夠有能力製作簡單的小程式了: 另外特別推薦一波福利(樣式庫,也就是說,各種

程式設計師眼中的統計學1】資訊圖形化:第一印象

package pictuer; import java.awt.Dimension; import java.awt.Font; import java.io.PrintStream; import java.text.DecimalFormat; import java.text.Simpl

程式設計師生存技能表1--通用技能

有精力的情況下多溝通,抓住重點 反饋要及時,避免出問題不反饋,影響進度,方式(正式的郵件、臨時的微信等即時通訊、捉急的給個電話) 工作有大小,責任心無大小(態度要端正,客戶第一) 週報透明 (意義:大家互相瞭解工作與心得,有利於自己的判斷與成長,觀察是一種很重要的技能,不是單純的給領導彙報工作)(週報需體現

微信小程式開發的一些知識點1

應用程式入口下最多有五級頁面,每級頁面可以無限多,但是小程式對整個程式的大小有要求,而且比較小,所以實際開發中,頁面是有限制的。 app.js,app.json,app.wxss配置全域性的,要是在頁面和app中都配置了,則使用就近原則 各頁面.wxml骨架,.wxss樣

hadoop的第一個hello world程序wordcount

說明 內部 interrupt cat 兼容 str 文件 extend 代碼 在hadoop生態中,wordcount是hadoop世界的第一個hello world程序。 wordcount程序是用於對文本中出現的詞計數,從而得到詞頻,本例中的詞以空格分隔。 關於map

RecyclerView-錯誤收集:當你重新整理RecyclerView程式崩掉的時候1

報錯資訊 摸著後腦勺,一臉懵逼地看著Android Studio列印著下面這段日誌: java.lang.IllegalArgumentException: Scrapped or attached views may not be recycled. i

.NET Core 小程式開發零基礎系列1——開發者啟用並牽手成功

  最近幾個月本人與團隊一直與小程式打交道,對小程式的實戰開發算比較熟悉,也因一些朋友經常問我各種小程式問題,無不能一一回答,想了很久,決定還是空餘時間來寫寫文章吧,偶爾發現一個人安靜的時候寫文章特爽,不信大夥可以試試哦^_^ 一般專案開發已快速為主,這時想到了一個小程式開源框架,盛派Senparc

go 語言 基礎 類型1

必須 const 表達式 基本 基本類 image 關鍵字 字符串 函數 變量 使用關鍵字 var定義變量,自動初始化為0值。如果提供初始化值,可省略變量類型,由編譯器自動推斷。 在函數內部可以使用 := 方式定義變量 func main() { x := 123