🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.c
Article #309572

Re: Błąd kompilacji: Control reaches end of non-void function

#309572
From: AK
Date: Wed, 03 Jan 2018 15:09
16 lines
1534 bytes
Użytkownik "Maciek" <moblaza@gmail.com> napisał:
> Mam funkcję która zwraca wskaźnik stosu, jak mogę ją poprawić lub ominąć błąd kompilacji:

> Control reaches end of non-void function

> funkcja:
>
>unsigned long sp(void) {
>   asm("movl %esp, %eax");
>}

Podstaw %esp pod C-owa zmiena (moze byc z modyfikatorem register) i zwroc zmienna.
PS:  tylko asm("movl %esp, %eax"); jest bledne. Skad wiesz ze kompoilator zwraca poprzez ax/eax?
To tylko konwencja kompilatora (fakt ze powszechna w swiecie x86) ale nie 'mus' w sensie C.

AK 
Technical Details
Message-ID: <p2irng$1r60$1@gioia.aioe.org>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail
References: <12c62252-1856-414e-9237-61a257bf9d99@googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.nask.pl!news.nask.org.pl!news.unit0.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail
From: "AK" <nobody@nowhere.net>
Newsgroups: pl.comp.lang.c
Subject: Re: Błąd kompilacji: Control reaches end of
 non-void function
Date: Wed, 3 Jan 2018 16:09:33 +0100
Organization: Aioe.org NNTP Server
Lines: 17
Message-ID: <p2irng$1r60$1@gioia.aioe.org>
References: <12c62252-1856-414e-9237-61a257bf9d99@googlegroups.com>
NNTP-Posting-Host: 5+M98RmRGH3uG3Y0OcK4wA.user.gioia.aioe.org
Mime-Version: 1.0
X-Complaints-To: abuse@aioe.org
X-Antivirus: Avast (VPS 180103-0, 2018-01-03), Outbound message
X-Notice: Filtered by postfilter v. 0.8.2
X-Newsreader: Microsoft Windows Mail 6.0.6002.18197
X-Priority: 3
X-Antivirus-Status: Clean
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.19694
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit