Hello,
I am proposing to create two new keywords for C, 'notnull' and
'nullable'.
Their meaning is a sort of 'design by contract', ensuring some rules
are
verified at compile-time. It should not require additional runtime-
checks
to be implemented.
I have posted my description of how it should work at this URL: http://sarnold.free.fr/wordpress/?p=71
Please read it and tell me what you think of it.
Regards,
Stéphane A. 20 2434 sa*****@free.fr wrote:
>
Hello,
I am proposing to create two new keywords for C, 'notnull' and
'nullable'.
Their meaning is a sort of 'design by contract', ensuring some rules
are
verified at compile-time. It should not require additional runtime-
checks
to be implemented.
I have posted my description of how it should work at this URL: http://sarnold.free.fr/wordpress/?p=71
Please read it and tell me what you think of it.
I don't need it.
I don't want it.
I don't like it.
I'm surprised it isn't already in C99.
--
pete sa*****@free.fr writes:
Hello,
I am proposing to create two new keywords for C, 'notnull' and
'nullable'.
Their meaning is a sort of 'design by contract', ensuring some rules
are
verified at compile-time. It should not require additional runtime-
checks
to be implemented.
I have posted my description of how it should work at this URL: http://sarnold.free.fr/wordpress/?p=71
Please read it and tell me what you think of it.
Regards,
Stéphane A.
Simplify it. There is no need for "nullable" since it's already there.
In addition I think it's a silly idea. Just wrap malloc to do what you want to
do rather than have the assignment to a notnull variable. Much more
efficient. Otherwise every time you assign to a notnull the system will
be performing these checks. sa*****@free.fr wrote:
Hello,
I am proposing to create two new keywords for C, 'notnull' and
'nullable'.
Their meaning is a sort of 'design by contract', ensuring some rules
are
verified at compile-time. It should not require additional runtime-
checks
to be implemented.
I have posted my description of how it should work at this URL: http://sarnold.free.fr/wordpress/?p=71
Please read it and tell me what you think of it.
Regards,
Stéphane A.
You can assert a parameter not being null in standard C by
int function(int MyTable[static 1]);
This means that the parameter MyTable has at least one
element, i.e. it can't be NULL.
True, it is NOT a GREAT syntax but it is standard.
jacob sa*****@free.fr wrote:
I am proposing to create two new keywords for C, [ ... ]
Since you are apparently proposing changes to the language the correct
group for that would be <news:comp.std. c>
santosh <sa*********@gm ail.comwrites: sa*****@free.fr wrote:
>I am proposing to create two new keywords for C, [ ... ]
Since you are apparently proposing changes to the language the correct
group for that would be <news:comp.std. c>
He is asking for C programmer's opinions. So here is perfectly valid.
On Sun, 04 Nov 2007 18:53:49 +0100, jacob navia wrote:
sa*****@free.fr wrote:
>Hello,
I am proposing to create two new keywords for C, 'notnull' and 'nullable'. Their meaning is a sort of 'design by contract', ensuring some rules are verified at compile-time. It should not require additional runtime- checks to be implemented. I have posted my description of how it should work at this URL: http://sarnold.free.fr/wordpress/?p=71 Please read it and tell me what you think of it.
Regards, Stéphane A.
You can assert a parameter not being null in standard C by
int function(int MyTable[static 1]);
Almost, but not quite.
This means that the parameter MyTable has at least one element, i.e. it
can't be NULL.
It means you can't call function with the result of malloc(1), while
occasionally (okay, rarely) that's actually useful.
Harald van Dijk wrote:
On Sun, 04 Nov 2007 18:53:49 +0100, jacob navia wrote:
>sa*****@free.fr wrote:
>>Hello,
I am proposing to create two new keywords for C, 'notnull' and 'nullable'. Their meaning is a sort of 'design by contract', ensuring some rules are verified at compile-time. It should not require additional runtime- checks to be implemented. I have posted my description of how it should work at this URL: http://sarnold.free.fr/wordpress/?p=71 Please read it and tell me what you think of it.
Regards, Stéphane A.
You can assert a parameter not being null in standard C by
int function(int MyTable[static 1]);
Almost, but not quite.
>This means that the parameter MyTable has at least one element, i.e. it can't be NULL.
It means you can't call function with the result of malloc(1), while
occasionally (okay, rarely) that's actually useful.
Can you explain what you say?
I didn't understand what you are saying. sa*****@free.fr wrote:
Hello,
I am proposing to create two new keywords for C, 'notnull' and
'nullable'.
Their meaning is a sort of 'design by contract', ensuring some rules
are
verified at compile-time. It should not require additional runtime-
checks
to be implemented.
I have posted my description of how it should work at this URL: http://sarnold.free.fr/wordpress/?p=71
Please read it and tell me what you think of it.
Your proposal should describe why the proposed feature
would be useful, why it would make life better for programmers
and/or improve the quality of programs. If the information
is already there, it is presented too subtly for me to grasp.
By the way, the example with free() is not well-chosen.
The behavior of free() with a NULL argument is well-defined;
there is no need to assert that the argument cannot be NULL,
because it can be. Perhaps an example with fclose() or
strlen() would raise fewer eyebrows.
--
Eric Sosman es*****@ieee-dot-org.invalid This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Nicolas Fleury |
last post by:
Hi everyone, I would to know what do you think of this PEP. Any comment
welcomed (even about English mistakes).
PEP: XXX
Title: Specialization Syntax
Version: $Revision: 1.10 $
Last-Modified: $Date: 2003/09/22 04:51:49 $
Author: Nicolas Fleury <nidoizo at gmail.com>
Status: Draft
Type: Standards Track
|
by: John Wood |
last post by:
I was just looking at an article about using nullable value types. (value
types that can effectively have no value and not be set).
The syntax is to append a question-mark to the value type in the
declaration, eg:
int? age;
I don't like that much, I think it would be much more consistent to use a
new keyword, such as "nullable". But anyways...
|
by: shawnk |
last post by:
Given several nullable boolean flags;
bool? l_flg_01 = true;
bool? l_flg_02 = false;
bool? l_flg_03 = true;
bool? l_result_flg = null;
I would have liked one of these syntax formats to work;
// if ( l_flg_01 && l_flg_02 && l_flg_03 ) // Line A
|
by: rubikzube* |
last post by:
Hi.
I'm trying to write a snippet of code to detect if a variable is a
nullable<t> struct, and I can't figure out the right syntax or if such
a thing is even possible... Below are the results that I got when I
attempted to perform some simple tests.
Nullable<int> i = 32;
bool isNullableClass = i is Nullable; // false
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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: 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...
| |