473,715 Members | 6,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reply the answer

Can we write a C programe with out a semicolon ? printing HELLOWORLD !

Jun 24 '07
105 3235
Richard Heathfield <rj*@see.sig.in validwrites:
[...]
Here's what I'd have liked C99 to be:

X removal of K&R-style function definitions
X removal of gets
X removal of unadorned %s from *scanf
X #ifntypedef (but at least I understand why I can't have it)
X function without return statement not permitted except where return
type is void
X no changes may invade the user's identifier namespace
X no new headers
X operators for integer power and powmod
X (limited) support for operator overloading :-) perhaps as some kind of
preprocessor step:
e.g. #overload +(bignum b1, bignum2) bignum_add(&b1, &b2)
X a C equivalent of STL - that is, a standard set of routines for
manipulating dynamic strings, arrays, maps, and so on
* removal of implicit int
* compound literals
* support for complex types
* %zu for size_t in printf
* variable argument macros
* trailing comma allowed in enum
* snprintf and vsnprintf
* inline functions
* return without expression not permitted in function that returns a
value (and vice versa)

...and NOTHING ELSE.
Interesting list.

Mine would include long long, and probably extended integer types
(though nobody seems to have bothered implementing the latter). It
would have made more sense to have char=8, short=16, int=32, and
long=64, but too many implementers have refused to do that; long long
is a common extension even without C99.

I'd also include <stdint.hand <stdbool.h>.

<tgmath.hseem s too complex for the benefit; I'd rather see language
features added to make type-generic math macros/functions possible
within the language.

Something I'd really like, which didn't make it into C99 is a
replacement for <time.h>.

Also, quite a few of the changes in C99 are clarifications of things
that were poorly worded in C90.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 26 '07 #21
Keith Thompson said:

<snip>
Interesting list.

Mine would include long long,
I never saw the point of that. If the implementation wants to provide a
64-or-more-bit integer type, it can use long int.
and probably extended integer types
(though nobody seems to have bothered implementing the latter).
Again, no point.
It
would have made more sense to have char=8, short=16, int=32, and
long=64, but too many implementers have refused to do that; long long
is a common extension even without C99.
If only they had called it "very long", I'd perhaps have looked more
kindly on it, despite the namespace invasion it would have represented.
I'd also include <stdint.hand <stdbool.h>.
I hesitated over <stdbool.h>, actually, and I can't say I'm dead set
against it.
<tgmath.hseem s too complex for the benefit; I'd rather see language
features added to make type-generic math macros/functions possible
within the language.
Right. <tgmath.hhas "special-interest group with lobbying expertise"
written all over it.
Something I'd really like, which didn't make it into C99 is a
replacement for <time.h>.
Such as? Guaranteed 1-second resolution? Or sub-second? Maybe a decent
way of handling clock() wrap? What did you have in mind?
Also, quite a few of the changes in C99 are clarifications of things
that were poorly worded in C90.
Sure, and I have no problem with a general tightening, although they do
seem to have broken a few things in the process. As you may recall from
a few years back, Lawrence drove a coach and horses through their
redefinition of 'lvalue'.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 26 '07 #22
Richard Heathfield <rj*@see.sig.in validwrites:
Keith Thompson said:
[...]
>Something I'd really like, which didn't make it into C99 is a
replacement for <time.h>.

Such as? Guaranteed 1-second resolution? Or sub-second? Maybe a decent
way of handling clock() wrap? What did you have in mind?
My main concern is completeness. mktime() is the inverse of
localtime(); where's the inverse of gmtime? More support for time
zones would be nice. The trailing '\n' on the result of asctime() is
just silly. The representation of time_t could be specified much
better.

David R. Tribble has an interesting proposal at
<http://david.tribble.c om/text/c0xlongtime.htm l>.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 26 '07 #23
Keith Thompson said:
Richard Heathfield <rj*@see.sig.in validwrites:
>Keith Thompson said:
[...]
>>Something I'd really like, which didn't make it into C99 is a
replacement for <time.h>.

Such as? Guaranteed 1-second resolution? Or sub-second? Maybe a
decent way of handling clock() wrap? What did you have in mind?

My main concern is completeness. mktime() is the inverse of
localtime(); where's the inverse of gmtime?
localtime(). At least, it is from where I'm sitting. :-)
More support for time
zones would be nice. The trailing '\n' on the result of asctime() is
just silly.
So is the format. Surely, whoever thought up "Nnn Mmm dd HH:MM:SS YYyy"
has to be completely out to lunch?
The representation of time_t could be specified much better.
Personally, I think it should be an unsigned integer type, with TIME_MAX
reserved for an invalid value, and other values representing the number
of seconds since 1/1/2001. And %tu should be added to *printf.
David R. Tribble has an interesting proposal at
<http://david.tribble.c om/text/c0xlongtime.htm l>.
I took a quick look. I lacked the time to look at it in more detail
because I just blew most of my coffee break on a trivium over in
comp.programmin g. Maybe later.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 26 '07 #24
Richard Heathfield said:
Keith Thompson said:
<snip>
>>
My main concern is completeness. mktime() is the inverse of
localtime(); where's the inverse of gmtime?

localtime(). At least, it is from where I'm sitting. :-)
Replied too fast. I meant mktime(), of course.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 26 '07 #25
Groovy hepcat Harald van =?UTF-8?B?RMSzaw==?= was jivin' on Sun, 24
Jun 2007 17:59:37 +0200 in comp.lang.c.
Re: reply the answer's a cool scene! Dig it!
>Richard Heathfield wrote:
>Harald van D?k said:
>>Richard Heathfield wrote:
Eric Sosman said:
guthena wrote:
>Can we write a C programe with out a semicolon ? printing
>HELLOWOR LD !
>
Yes.

I'm curious. I can see the print part easily enough, but how are you
going to handle the return statement? (Email reply welcome if you
don't want to spoil the OP's fun.)

There is no need for a return statement.

Oh. *That* kind of program. Count me out.

I'm not sure what you mean by "that" kind. You don't need a return statement
in a strictly conforming C90 program that prints "HELLOWORLD " and exits
successfully .

#include <stdio.h>
#include <stdlib.h>
int main(void) {
puts("HELLOWORL D");
exit(0);
}
That is *not* a C90 conforming program. In C90, a function,
including main(), with non-void return type requires a return
statement. You were thinking, perhaps, of C99?
The above program also does not live up to the specification, which
was to write a program without using a semicolon.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technicall y correct" English; but since when was rock & roll "technicall y correct"?
Jun 26 '07 #26
Peter 'Shaggy' Haywood wrote On 06/26/07 10:12,:
Groovy hepcat Harald van =?UTF-8?B?RMSzaw==?= was jivin' on Sun, 24
Jun 2007 17:59:37 +0200 in comp.lang.c.
Re: reply the answer's a cool scene! Dig it!

>>Richard Heathfield wrote:
>>>Harald van D?k said:

Richard Heathfield wrote:

>Eric Sosman said:
>
>>guthena wrote:
>>
>>>Can we write a C programe with out a semicolon ? printing
>>>HELLOWOR LD !
>>
> Yes.
>
>I'm curious. I can see the print part easily enough, but how are you
>going to handle the return statement? (Email reply welcome if you
>don't want to spoil the OP's fun.)

There is no need for a return statement.

Oh. *That* kind of program. Count me out.

I'm not sure what you mean by "that" kind. You don't need a return statement
in a strictly conforming C90 program that prints "HELLOWORLD " and exits
successfull y.

#include <stdio.h>
#include <stdlib.h>
int main(void) {
puts("HELLOWOR LD");
exit(0);
}


That is *not* a C90 conforming program. In C90, a function,
including main(), with non-void return type requires a return
statement.
Chapter and verse? (In particular, C&V for the case
where, as above, the function does not return at all?)
The above program also does not live up to the specification, which
was to write a program without using a semicolon.
True, but the modification to eliminate the semicolon
is simple. I imagine that "Groovy hepcat Harald" was
reluctant to do *all* of the idiot O.P.'s homework for him.

--
Er*********@sun .com
Jun 26 '07 #27
Richard Heathfield <rj*@see.sig.in validwrites:
Keith Thompson said:
>Richard Heathfield <rj*@see.sig.in validwrites:
>>Keith Thompson said:
[...]
>>>Something I'd really like, which didn't make it into C99 is a
replacemen t for <time.h>.

Such as? Guaranteed 1-second resolution? Or sub-second? Maybe a
decent way of handling clock() wrap? What did you have in mind?

My main concern is completeness. mktime() is the inverse of
localtime(); where's the inverse of gmtime?

localtime(). At least, it is from where I'm sitting. :-)
(corrected to mktime() in a followup)

Yeah, but if we all sat where you're sitting, it would be pretty darn
crowded.

[...]
>The representation of time_t could be specified much better.

Personally, I think it should be an unsigned integer type, with TIME_MAX
reserved for an invalid value, and other values representing the number
of seconds since 1/1/2001. And %tu should be added to *printf.
I don't want time_t to be unsigned. I want it to be able to represent
times in the past, and with a big enough type (64 bits or better), the
top bit is much better spent representing times in the past than in
the unimaginably distant future.

Ideally, I'd like a single arithmetic type that has both as much range
(past an future) and as much precision (nanoseconds?) as you could
want. If that's impractical, I'd settle for a better specified time_t
with 1-second resolution, and something like the Unix gettimeofday()
function for finer precision when it's needed. (gettimeofday() gives
you a structure containing a time_t representing seconds and an
integer representing microseconds.)

[...]

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 26 '07 #28
phayw...@alphal ink.com.au.NO.S PAM (Peter 'Shaggy' Haywood) wrote:
In C90, a function, including main(), with non-void return
type requires a return statement.
Not true. (An example of a conforming function
that has no return statement has been posted
on this thread already, for one).

Jun 26 '07 #29
Keith Thompson <ks***@mib.orgw rote:
Richard Heathfield <rj*@see.sig.in validwrites:
Keith Thompson said:
Richard Heathfield <rj*@see.sig.in validwrites:
Keith Thompson said:
[...]
Something I'd really like, which didn't make it into C99 is a
replacement for <time.h>.

Such as? Guaranteed 1-second resolution? Or sub-second? Maybe a
decent way of handling clock() wrap? What did you have in mind?

My main concern is completeness. mktime() is the inverse of
localtime(); where's the inverse of gmtime?
localtime(). At least, it is from where I'm sitting. :-)

(corrected to mktime() in a followup)

Yeah, but if we all sat where you're sitting, it would be pretty darn
crowded.

[...]
The representation of time_t could be specified much better.
Personally, I think it should be an unsigned integer type, with TIME_MAX
reserved for an invalid value, and other values representing the number
of seconds since 1/1/2001. And %tu should be added to *printf.

I don't want time_t to be unsigned. I want it to be able to represent
times in the past, and with a big enough type (64 bits or better), the
top bit is much better spent representing times in the past than in
the unimaginably distant future.

Ideally, I'd like a single arithmetic type that has both as much range
(past an future) and as much precision (nanoseconds?) as you could
want. If that's impractical, I'd settle for a better specified time_t
with 1-second resolution, and something like the Unix gettimeofday()
function for finer precision when it's needed. (gettimeofday() gives
you a structure containing a time_t representing seconds and an
integer representing microseconds.)
Bah. Why settle for a today-only solution? We want a type that is able
to represent times very precisely now, for measurement and scientific
purposes. We also want a type that can represent dates far into the past
and future, for historical, geological, and insurance purposes; and we
don't need great precision for these.

I say we opt for a long double, centred on the date at which the new
Standard comes into force.

Richard
Jun 27 '07 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1660
by: Showcar | last post by:
Thank you for your interest in the Hendrick Motorsports Showcar Program. In an attempt to answer your questions more effectively and efficiently, we have developed this automatic response. If this reply does not satisfactorily answer your questions, we will gladly respond to you personally as soon as possible. · If you would like more information on how to book a showcar appearance, please provide us with as much information as possible,...
1
1204
by: sorCrer | last post by:
Hi Juan, Thanks for the reply! Unfortunately your answer didn't help me. If I don't 'Import' the custom class then I can't call any of it's functions. This problem goes away if I compile the .vb file first, and import the namespace and class with an import directive! It's almost as if the framework can't see the /code directory the way it should.
4
1206
by: K.N.Ranjit | last post by:
Hi to all friends out there.I am presently working in TCS and I am supposed to do the work given to me in line cordinates using VB.net.But over here I face a problem (ie) I want my coordinate (0,0) to start in the lower-left corner of my form instead of the default upper-left corner of the form.If anyone could provide me the solution I would be very contended. I could do the same in VB by just changing that scale top property which would...
19
1700
by: wcfinvader | last post by:
I have known this girl forever every since 3rd grade we are both in 10th grade now and I feel like I am in love with her and I want to ask her out but I dont know if I should call her tonight or this weekend or if I should wait until Monday at school to ask her. (We dont have school Friday Parent techer confernce). I know she likes me but not sure if she loves me. in 6th grade she asked me to go out with her and I didnt at the time...
23
2021
by: novice | last post by:
I dint find a proper group to post this, so i'm asking this question. If you think this question is irrelevent then dont answer, but i expect good replies from experts. I wondor, how these guys who answer to complicated questions have mastered C. I'm a beginner in C, and wondor how to master C. Should i study theory, or start writing programs? If i should start writing programs, What programs should i start with?
3
5410
by: Frank | last post by:
I am attempting to develop a solution where I handle bounced e-mails. I wish to field all bounced emails in a custom email account such a bounced@mycompany.com From the aricle at http://www.systemwebmail.com/faq/2.7.aspx, I gather I could use: mail.Headers.Add( "Reply-To", "alternate_email@mycompany.com" ); When I test this from a test web app, I don't seem to field a bounced email
0
1194
by: roberto | last post by:
Sorry, but posting a reply does no work (6 hours after the "successful" post the message is not shown)) so I decided to post it. This is a reply to a thread http://groups.google.pl/group/microsoft.public.dotnet.framework.webservices/browse_thread/thread/1de13b5ef20c837a/78006eaa8e840fd1#78006eaa8e840fd1 Web Service API is a minimal one, there is nothing to refactor. What I want is to hide complexities of the proxy from third-party...
1
1669
by: Karon Davis | last post by:
Hi, can someone tell me if it's possible to send delivery status notifications (or NDRs) to the Reply-To address (specified in CDOSYS script) rather than the FROM address? thanks.
0
8718
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,...
0
9340
Oralloy
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...
0
9196
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7973
agi2029
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...
0
5967
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();...
0
4477
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...
0
4738
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3175
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
2
2539
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.