LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-01-2020, 02:12 AM   #16
Fat_Elvis
Member
 
Registered: Oct 2016
Distribution: FreeDOS 1.2
Posts: 299

Rep: Reputation: 90

Quote:
Originally Posted by pan64 View Post
Nowadays it is much more complicated, but it is still valid: these qualifiers are used to restrict the developers (human beeings) to avoid the misuse of fixed/hardcoded values.

I'm not sure GCC would compile something like this -- at least not without profound warnings.


I mean, one could as well type "sudo dd if=/dev/null of=/dev/mem" if so inclined. I kind of wonder what that would do, but not enough to try, heh.
 
Old 09-01-2020, 07:32 AM   #17
SoftSprocket
Member
 
Registered: Nov 2014
Posts: 324

Rep: Reputation: Disabled
GCC most certainly will compile it, as should any standards compliant C compiler. It's not an error. The C compiler is free to emit a warning and GCC will but it is valid C.
 
Old 09-01-2020, 07:47 AM   #18
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 15,097

Rep: Reputation: 4972Reputation: 4972Reputation: 4972Reputation: 4972Reputation: 4972Reputation: 4972Reputation: 4972Reputation: 4972Reputation: 4972Reputation: 4972Reputation: 4972
https://stackoverflow.com/questions/...er-target-type
see -W<flags>, this can be enabled/disabled
 
Old 09-01-2020, 10:48 PM   #19
Fat_Elvis
Member
 
Registered: Oct 2016
Distribution: FreeDOS 1.2
Posts: 299

Rep: Reputation: 90
I have read the linked articles.

I don't see the need to change the C language, since _many_ alternatives with similar capabilities exist. Anyone is free to use C++, or Rust, or Go.

C is sometimes called a "portable assembler," and that it does very well. It is seldom used outside of the Unix crowd anyways. If I had a vote, I'd go with: "leave it alone."

Last edited by Fat_Elvis; 09-01-2020 at 10:51 PM.
 
  


Reply

Tags
c programming, constant, pointers


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
In c using local variable as seperate functions or a global variable for a const Alpha90 Programming 4 06-15-2015 06:04 AM
how to assign a “const void*” to a “const uint64_t*” in cuda c? arungpillai09054 Programming 2 04-25-2013 06:14 AM
Convert const wchar_t* to const char* to use in fprintf() coders123 Programming 1 01-17-2011 03:47 PM
any difference between "const myClass &obj" and "myClass const &obj"? parv Programming 9 01-09-2008 08:58 AM
diff between #define and const defined variable b123coder Programming 7 06-27-2005 08:02 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration