Hi,
In my code, I have a function which has a return value in the
declaration:
bool myFunction( int a) {
// my implmentation
}
how come the code still compile even if I don't have a return value
(neither true/false). How can I enforce that ? i am using gcc on
linux.
Thank you. 3 4208 Al************@ gmail.com wrote: In my code, I have a function which has a return value in the declaration:
bool myFunction( int a) { // my implmentation
}
how come the code still compile even if I don't have a return value (neither true/false). How can I enforce that ? i am using gcc on linux.
Ask in gnu.gcc.help (or gnu.g++.help). Often, if your compiler gives
you a warning, you can try "treat warnings as errors", and jack the
warning level all the way up.
Generally speaking, falling off the end of a function that is declared
as returning a value has _undefined_ behaviour, and no diagnostic is
required.
V
--
Please remove capital As from my address when replying by mail Al************@ gmail.com wrote in news:1141420868 .941649.78800
@t39g2000cwt.go oglegroups.com: Hi,
In my code, I have a function which has a return value in the declaration:
bool myFunction( int a) { // my implmentation
}
how come the code still compile even if I don't have a return value (neither true/false). How can I enforce that ? i am using gcc on linux.
Ask in a newsgroup dedicated to your compiler. See what you can find by
looking through your compiler's documentation.
Victor Bazarov wrote in message ... Al************ @gmail.com wrote: In my code, I have a function which has a return value in the declaration:
bool myFunction( int a) { // my implmentation }
how come the code still compile even if I don't have a return value (neither true/false). How can I enforce that ? i am using gcc on linux.
Ask in gnu.gcc.help (or gnu.g++.help). Often, if your compiler gives you a warning, you can try "treat warnings as errors", and jack the warning level all the way up.
OP:
try -Wall
which includes:
-Wreturn-type
Warn whenever a function is defined with a return-type that defaults to int.
Also warn about any return statement with no return-value in a function whose
return-type is not void.
For C++, a function without return type always produces a diagnostic message,
even when -Wno-return-type is specified. The only exceptions are main and
functions defined in system headers.
--
Bob R
POVrookie This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: soup_or_power |
last post by:
I'm passing the return from window.open as a function argument and
getting the error "missing ] after element list" when tested with
FireFox. Here is the relevant code. Many thanks for your help.
function blurCkbox(num, disp, but_id, sugg)
{
if (num == 1) {
eval("self.opener.document.forms." + but_id + ".value=\'" +
sugg + "\'");
|
by: Carlos Martinez Garcia |
last post by:
Hi all:
I have a piece of code similar to this:
bool MyClass::myMethod() {
... (there is no return)
}
I have a random behaviour. It depends on if I'm debuging the code or
not. When I'm debuging it returns false, but in normal execution it
|
by: Jigar.Patel |
last post by:
I have simple remoting server exposing following simple method. When I try to
add webreference to this server in another project,
it gives me following error:
Custom tool error: Unable to import WebService/Schema. Unable to import
binding 'MyRemoteObjectBinding' from namespace
'http://schemas.microsoft.com/clr/nsassem/RemoteServer/RemoteServer%2C%20Version%3D1.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3Dnull'.
Unable to import...
|
by: inventor |
last post by:
I'm doing programming for my science prodject, and when I was
programming (I'm building an alphebatizer) I ran into this bug: I've
got an input box, but no button or output box. so I do some reaserch,
insert a button, and when I open it up, instead of the button being
added, I lost the input box. Can ANYONE PLEASE HELP ME!!!!!!!!!!!!!
I've included a copy of my code as it is:
<HTML>
<HEAD> Riehl's Alphebatizer
<SCRIPT...
|
by: le0 |
last post by:
Hello guys,
Im really having a hard time doing this, I have a record set with the ItemNo
field with the data type as Text. In the record that I have, I want to find
the missing number in the series
for example:
1
3
4.1
| |
by: Matt Kruse |
last post by:
According to standards, if an option is selected and it has no VALUE
attribute, the contents of the option tag is to be submitted.
So:
<select name="sel">
<option selected>Value</option>
</select>
will submit as "sel=Value".
|
by: Lo'oris |
last post by:
$name=$_GET;
if (!$name)
$name="value";
i can't figure out how to shorten this thing. Is there some kind of
operator i don't know about?
|
by: Alex Popescu |
last post by:
Hi all!
I am pretty sure this has been asked a couple of times, but I don't seem
to find it on the archives (Google seems to have a couple of problems
lately).
I am wondering what is the most pythonic way of dealing with missing
keys and default values.
According to my readings one can take the following approaches:
|
by: Christoph Zwerschke |
last post by:
I'm just reading PEP 3107 (function annotations) and wonder why
exceptions are not mentioned there. I think it would be helpful if one
could specify which exceptions can be raised by a function, similarly to
how it is possible in C++ using the "throw" clause. The syntax would be
something like this:
def foo(a: expr, b: expr = 5) raises expr -expr:
The expr in that "raises" clause should be a list of Exceptions.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |