473,698 Members | 2,139 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 3229
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
1657
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
1201
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
1699
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
2017
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
5408
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
1192
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
1667
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
8671
marktang
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...
0
8598
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,...
1
8887
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,...
0
7709
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...
1
6515
isladogs
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...
0
4613
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3037
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
2321
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1997
bsmnconsultancy
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...

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.