'evening.
I'm not new to C and have been programming in it since I was 8 but
here's a strange problem I've never seen before.
When I compile a program from our C course with a windows compiler
there is no problem but when I try to compile it with a linux compiler
it complains that
a_03.c:(.text+0 x4d): warning: the `gets' function is dangerous
and should not be used.
Is linux more dangerous than windows? Where can I download a
non dangerous gets function? I have never used gets before is
there undefined behavior somewhere?
Here is a trimmed down example program from my assignment that
demonstrates the problem
#include <stdio.h>
#include <malloc.h>
void main()
{
char *string;
printf("enter string (max 2000 chars): ");
fflush(stdin);
fflush(stdout);
string = (char *)malloc(2001);
if(!string) exit(1);
gets(string);
printf("you entered: %s\n", string);
free(string);
exit(0);
}
On windows with TurboC and Lcc no error is printed. On linux with
gcc it says gets is dangerous.
Please advise my instructor says gcc is overly pedantic.
Aug 10 '08
233 8725
In article <sl************ *******@nospam. invalid>,
Antoninus Twink <no****@nospam. invalidwrote:
>On 16 Aug 2008 at 21:47, ke**********@gm ail.com wrote:
>>This study found that, using the data between 1995-1999 in a country where back seat belts were not mandatory (in this case the data came from Japan), the front seat passenger's death rate increase by more than 75% if back seat was not wearing a seat belt. http://www.ncbi.nlm.nih.gov/pubmed/15094416 You've completely missed the point.
Of course. This is clc. What did you expect?
>I'm not arguing for a second that having all occupants of a car wear seatbelts isn't an extremely efficacious safety measure that anyone with half a brain cell would insist upon when they were driving.
I'm geninely confused by this. I don't think most American cars have
back seat seatbelts. I may just be out of touch with modern trends.
>The question was whether the state should *force* people to avoid taking the risk.
This gets into politics and life views. I'm a little surprised to see
it being discussed here. But let me just say that the idea that the
world *should* be made as safe as possible - and that government is the
tool that should be employed to bring this about - does have a lot of
appeal. Like "int main()", it is kinda hard to argue against it.
>If I go abseiling and trust my life to someone I know to be drunk or
What is "abseiling" ? A typo?
On Aug 17, 7:02*am, "Serve Lau" <ni...@qinqin.c omwrote:
>
This study found that, using the data between 1995-1999...
you're assuming that accidents are always frontal which they arent. Most of
the time people try to steer away or are hit by a car from the side who was
trying to steer away. crash test dummies dont do that.
I did not assume anything. The statistics takes into account
the different types of collision and their relative occurrence
frequency.
Fact is, two separate studies (one says 80%, the other says 75%)
the front seat passenger dies 80% (or 75%) more likely when
the rear passenger isn't buckeled in. And that's with all
types of collisions considered, in an entire country,
with rural and urban and short trips and long trips all combined.
On Aug 17, 8:07*am, Antoninus Twink <nos...@nospam. invalidwrote:
>
On 16 Aug 2008 at 21:47, kenny.rio...@gm ail.com wrote:
This study found that, using the data between 1995-1999 in a country
where back seat belts were not mandatory (in this case the data
came from Japan), the front seat passenger's death rate
increase by more than 75% if back seat was not wearing a seat belt. http://www.ncbi.nlm.nih.gov/pubmed/15094416
You've completely missed the point.
No, *you* missed the point. Someone pointed this possibility to you.
You said "has this really happened?" and you asked for "citation".
So here is the citation. Now you say it's pointless. What's it gonna
be?
>
I'm not arguing for a second that having all occupants of a car wear
seatbelts isn't an extremely efficacious safety measure that anyone with
half a brain cell would insist upon when they were driving.
The question was whether the state should *force* people
to avoid taking the risk.
Argue with your congressman then (if you're in Canada, UK, Japan,
or some of the select US states), or just be happy (if you live
elsewhere)
"Joachim Schmitz" <no*********@sc hmitz-digital.dewrote in message
news:g8******** **@online.de...
Antoninus Twink wrote:
>On 16 Aug 2008 at 21:47, ke**********@gm ail.com wrote:
>>>This study found that, using the data between 1995-1999 in a country where back seat belts were not mandatory (in this case the data came from Japan), the front seat passenger's death rate increase by more than 75% if back seat was not wearing a seat belt. http://www.ncbi.nlm.nih.gov/pubmed/15094416 You've completely missed the point.
I'm not arguing for a second that having all occupants of a car wear seatbelts isn't an extremely efficacious safety measure that anyone with half a brain cell would insist upon when they were driving.
The question was whether the state should *force* people to avoid taking the risk.
If I go abseiling and trust my life to someone I know to be drunk or incompetent, should that be illegal? If I choose to drive allowing the person in the seat behind me not to wear a seatbelt, should that be illegal?
Committing suizide _is_ illegal. The attempt gets punished.
The dead body gets locked up forever.
On 17 Aug 2008 at 13:14, Kenny McCormack wrote:
Antoninus Twink <no****@nospam. invalidwrote:
>>The question was whether the state should *force* people to avoid taking the risk.
But let me just say that the idea that the world *should* be made as
safe as possible - and that government is the tool that should be
employed to bring this about - does have a lot of appeal. Like "int
main()", it is kinda hard to argue against it.
Well, not really. The state shouldn't ban something just because it's
dangerous. The state should trust people to make their own judgment
about what level of personal risk they want to take, insofar as it
doesn't seriously affect others. It's just the difference between a
liberal society and a totalitarian one.
>>If I go abseiling and trust my life to someone I know to be drunk or
What is "abseiling" ? A typo?
I don't think so?
On 17 Aug 2008 at 13:30, ke**********@gm ail.com wrote:
No, *you* missed the point. Someone pointed this possibility to you.
You said "has this really happened?" and you asked for "citation".
So here is the citation. Now you say it's pointless. What's it gonna
be?
Oops, yes, sorry. It's relevant to that, you're right.
>The question was whether the state should *force* people to avoid taking the risk.
Argue with your congressman then (if you're in Canada, UK, Japan,
or some of the select US states), or just be happy (if you live
elsewhere)
Unfortunately, once a freedom has been removed from the individual by
the state, history shows that it's very hard indeed to get the state to
give it back.
In article <sl************ *******@nospam. invalid>,
Antoninus Twink <no****@nospam. invalidwrote:
>On 17 Aug 2008 at 13:14, Kenny McCormack wrote:
>Antoninus Twink <no****@nospam. invalidwrote:
>>>The question was whether the state should *force* people to avoid taking the risk.
But let me just say that the idea that the world *should* be made as safe as possible - and that government is the tool that should be employed to bring this about - does have a lot of appeal. Like "int main()", it is kinda hard to argue against it.
Well, not really. The state shouldn't ban something just because it's dangerous. The state should trust people to make their own judgment about what level of personal risk they want to take, insofar as it doesn't seriously affect others. It's just the difference between a liberal society and a totalitarian one.
I don't doubt that you (quite sensibly) believe that (and I'm not saying
I agree or disagree). But I'm saying that the alternative view (the one
described above - i.e., that the world *should* be idiot-proofed) is a
reasonable one to hold - and one that many do hold.
Just like the view that one should not cast the return value of malloc().
Heh - I think I've just run out of clc-valid analogies...
>>>If I go abseiling and trust my life to someone I know to be drunk or
What is "abseiling" ? A typo?
I don't think so?
Then what is it?
On 17 Aug 2008 at 17:54, Kenny McCormack wrote:
Antoninus Twink <no****@nospam. invalidwrote:
>>On 17 Aug 2008 at 13:14, Kenny McCormack wrote:
>>What is "abseiling" ? A typo?
I don't think so?
Then what is it?
$ dict abseil
1 definition found
From WordNet (r) 2.0 [wn]:
abseil
n : a descent down a nearly vertical surface by using a doubled
rope that is coiled around the body and attached to some
higher point
v : lower oneself with a double rope coiled around the body from
a mountainside; "The ascent was easy--roping down the
mountain would be much more difficult and dangerous";
"You have to learn how to abseil when you want to do
technical climbing" [syn: {rappel}, {rope down}]
Chris M. Thomasson wrote:
"Joachim Schmitz" <no*********@sc hmitz-digital.dewrote in message
news:g8******** **@online.de...
>Antoninus Twink wrote:
>>On 16 Aug 2008 at 21:47, ke**********@gm ail.com wrote: This study found that, using the data between 1995-1999 in a country where back seat belts were not mandatory (in this case the data came from Japan), the front seat passenger's death rate increase by more than 75% if back seat was not wearing a seat belt. http://www.ncbi.nlm.nih.gov/pubmed/15094416
You've completely missed the point.
I'm not arguing for a second that having all occupants of a car wear seatbelts isn't an extremely efficacious safety measure that anyone with half a brain cell would insist upon when they were driving.
The question was whether the state should *force* people to avoid taking the risk.
If I go abseiling and trust my life to someone I know to be drunk or incompetent , should that be illegal? If I choose to drive allowing the person in the seat behind me not to wear a seatbelt, should that be illegal?
Committing suizide _is_ illegal. The attempt gets punished.
The dead body gets locked up forever.
8-). I said: "the attempt gets punished", of course I meant "the failed
attempt gets punished"
Bye, Jojo
Antoninus Twink wrote:
On 17 Aug 2008 at 17:54, Kenny McCormack wrote:
>Antoninus Twink <no****@nospam. invalidwrote:
>>On 17 Aug 2008 at 13:14, Kenny McCormack wrote: What is "abseiling" ? A typo?
I don't think so?
Then what is it?
$ dict abseil
1 definition found
From WordNet (r) 2.0 [wn]:
abseil
n : a descent down a nearly vertical surface by using a doubled
rope that is coiled around the body and attached to some
higher point
v : lower oneself with a double rope coiled around the body from
a mountainside; "The ascent was easy--roping down the
mountain would be much more difficult and dangerous";
"You have to learn how to abseil when you want to do
technical climbing" [syn: {rappel}, {rope down}]
Apparently lend from the German language, in which it does have exactly the
same meaning and even spelling.
Bye, Jojo This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bill Cunningham |
last post by:
I read an article in a book about Perl and Common Gateway Interface and it
mentioned C. It said that C could damage your computer. I don't know wether
it meant the standard or compiler issuses. I was a little upset. Well more
upset. I sent Dennis Ritchie and email. I don't know if he'll respond if he
gets it. Sometimes he does sometimes not. How can C damage your computer?
Bill
|
by: b83503104 |
last post by:
When are they not consistent?
|
by: cesark |
last post by:
Hi !
I have important doubts about how to handle the security in asp.net
vb.net web forms. Somebody can help me?
1. If you have setting ‘validateRequest=true’ in .net framework1.1,
What can do you do to improve the security? Because although you have
validations on server side you can enter dangerous characters in a
text field, with the exception of telephone numbers or similar.
|
by: Lee |
last post by:
Hi
Whenever I use the gets() function, the gnu c compiler gives a
warning that it is dangerous to use gets(). Is this due to the
possibility of array overflow? Is it correct that the program flow can
be altered by giving some specific calculated inputs to gets()? How
could anyone do so once the executable binary have been generated? I
have heard many of the security problems and other bugs are due to
array overflows.
|
by: Brendan |
last post by:
Hi,
I'm trying to mimic the IPC/messaging system of an specific OS in a
portable way by using GCC's library. The IPC system uses buffered
asynchronous messages, where any thread can send a message to any other
thread (i.e. to the "threadID") without blocking, and the receiver does
any security checks necessary.
I'm trying to implement the portable/linux version on top of
sockets/datagrams ("SOCK_DGRAM" in the local namespace), and so...
| |
by: lovecreatesbea... |
last post by:
C stops the conversion from (char **) to (const char **). c-faq.com
sec 11.10 has explanation on this point. But, for example, even the
conversion from (char *) to (const char *) brings the same dangerous
as in the previous conversion. Why the latter simple but dangerous one
is allowed in C?
$ cat f1.c
int main(void)
{
const char c = 'a';
|
by: Thomas.li |
last post by:
Hi,
I want to convert CString to LPBYTE like
LPBYTE lpByte = (BYTE*)(LPCTSTR)cstring;
is it very dangerous to do that?
|
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: 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: 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...
| |
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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |