Dear all,
I had this following doubt,while java is able to carryon with out
pointers why C language cant be modified to remove pointer?Hows java
able to do this with out pointers?
I jus plead sorry to those who advice me to post it to java people
because I have already done it.
Jus want to know alternatives to pointers which can be used with
C.While pointers provide flexibility most bugs are with respect to
pointers.So will it not be good if we are able to either forgo the
pointers or do some sort of modification(I am not aware how,but it can
be considered for research) so that our s/w s are more pure with out
bugs?
I am sorry for my amature query,but it will be helpful and I will be
thankful to all who makes me understand this.
Regards,
s.subbarayan
Nov 14 '05
19 1632
In <pa************ *************** *@sig.now> August Derleth <se*@sig.now> writes: On Fri, 21 May 2004 18:51:57 +0100, Malcolm wrote:
You could try writing a "C--" (without pointers).
The name 'C--' is already in use: It's a language even lower-level than C that is being touted as a compiler backend language.
http://www.cse.ogi.edu/PacSoft/projects/C--/
It's already in use by how many people?
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
In <c3************ **************@ posting.google. com> s_**********@re diffmail.com (s.subbarayan) writes: I had this following doubt,while java is able to carryon with out pointers
Not true. It just doesn't call them pointers and doesn't make as flexible
as the C pointers.
why C language cant be modified to remove pointer?
Try to engage your brain and explain the advantages of a C without
pointers. What class(es) of applications would be better addressed by
such a language?
Removing pointers from C simply because newbies have a hard time getting
them right is NOT going to happen: one is supposed to be a C newbie for
a few months and something better than that for the rest of his life as a
C programmer...
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
"s.subbaray an" <s_**********@r ediffmail.com> wrote in message
news:c3******** *************** ***@posting.goo gle.com... I had this following doubt,while java is able to carryon with out pointers why C language cant be modified to remove pointer?Hows java able to do this with out pointers?
Removing pointers from C is like removing the gas pedal from a car. It'd be
a lot easier to learn, but you wouldn't get anywhere.
References in Java, Perl, etc. are just pointers with garbage collection and
other abstractions to make them "safe". This conflicts with the primary
goal of C, which is to be as close to assembly as possible while remaining
(mostly) portable. Since the machine deals in pointers, any abstraction
above that necessarily means a loss in run-time efficiency.
Jus want to know alternatives to pointers which can be used with C.
There is no alternative to pointers in a non-trivial C program because
they're a fundamental part of the language. If you want a language that
hides pointers from you, go learn Java or Perl.
While pointers provide flexibility most bugs are with respect to pointers.
Perhaps among novices, but not among experienced programmers. Being able to
use pointers correctly is a key attribute of someone who really understands
C.
S
--
Stephen Sprunk "Stupid people surround themselves with smart
CCIE #3723 people. Smart people surround themselves with
K5SSS smart people who disagree with them." --Aaron Sorkin
s.subbarayan <s_**********@r ediffmail.com> wrote: Dear all, I had this following doubt,while java is able to carryon with out pointers why C language cant be modified to remove pointer?Hows java able to do this with out pointers? I jus plead sorry to those who advice me to post it to java people because I have already done it. Jus want to know alternatives to pointers which can be used with C.While pointers provide flexibility most bugs are with respect to pointers.So will it not be good if we are able to either forgo the pointers or do some sort of modification(I am not aware how,but it can be considered for research) so that our s/w s are more pure with out bugs?
I am sorry for my amature query,but it will be helpful and I will be thankful to all who makes me understand this. Regards, s.subbarayan
You got things wrong: Every object is a pointer in Java. You just don't see
it. Basic types such as int and short are not pointers. But everything else is.
--
Viktor Lofgren, Umea, Sweden
Mainly self-eductated UNIX programmer, running Slackware-current. mw*****@newsguy .com (Michael Wojcik) writes: In article <cu************ *@zero-based.org>, Martin Dickopp <ex************ ****@zero-based.org> writes: Eric Sosman <Er*********@su n.com> writes:
> Malcolm wrote: >> All computer programs need to address memory (ie use pointers) >> internally. > > Off-topic nit: Alan Turing demonstrated that this is false.
Even a Turing machine has a "pointer" as a part of its state: the current tape position.
An n-PDA (n > 1) is equivalent to a TM. I don't see any pointer- equivalent in an n-PDA.
I would consider a top-of-stack position a pointer.
Martin
--
,--. Martin Dickopp, Dresden, Germany ,= ,-_-. =.
/ ,- ) http://www.zero-based.org/ ((_/)o o(\_))
\ `-' `-'(. .)`-'
`-. Debian, a variant of the GNU operating system. \_/
"Dan Pop" <Da*****@cern.c h> wrote in message Try to engage your brain and explain the advantages of a C without >
pointers. What class(es) of applications would be better addressed > by
such a language?
My MiniBasic doesn't use pointers. There is no PEEK or POKE. However it does
have a DIM statement and it is possible to redimension arrays, which of
course calls malloc() internally. Trying an out-of-bounds access will cause
an error.
The advantage of MiniBasic is that it is impossible, barring bugs on my
part, to cause undefined behaviour. The idea is to allow programs to be
extended by anyone who learnt a bit of BASIC from having a microcomputer
back in the olden days.
On Mon, 24 May 2004 14:24:55 +0000, Dan Pop wrote: In <pa************ *************** *@sig.now> August Derleth <se*@sig.now> writes:
On Fri, 21 May 2004 18:51:57 +0100, Malcolm wrote:
You could try writing a "C--" (without pointers).
The name 'C--' is already in use: It's a language even lower-level than C that is being touted as a compiler backend language.
http://www.cse.ogi.edu/PacSoft/projects/C--/
It's already in use by how many people?
Well, the implementors, for a few.
Good point, I suppose: C-- is probably a solution looking for a problem,
at least at this stage. Maybe when seriously complex hardware
architectures filter down to the mass-market PCs (for example, RISC-like
out-of-order execution and VLIW slot-filling), compiler designers will
want to palm off as much of the /real/ hard work to the backend folks,
making intermediate languages more interesting.
August "EPIC challenges to compiler design..." Derleth
--
yvoregnevna gjragl-guerr gjb-gubhfnaq guerr ng lnubb qbg pbz
To email me, rot13 and convert spelled-out numbers to numeric form.
"Makes hackers smile" makes hackers smile.
In article <cu************ *@zero-based.org>, Martin Dickopp <ex************ ****@zero-based.org> writes: mw*****@newsguy .com (Michael Wojcik) writes:
In article <cu************ *@zero-based.org>, Martin Dickopp <ex************ ****@zero-based.org> writes: Eric Sosman <Er*********@su n.com> writes:
> Malcolm wrote: >> All computer programs need to address memory (ie use pointers) >> internally. > > Off-topic nit: Alan Turing demonstrated that this is false.
Even a Turing machine has a "pointer" as a part of its state: the current tape position.
An n-PDA (n > 1) is equivalent to a TM. I don't see any pointer- equivalent in an n-PDA.
I would consider a top-of-stack position a pointer.
Sigh. I was going to address this proleptically, then didn't out
of laziness.
I can see the argument for calling the current tape position in a
TM a "pointer". It marks one of the positions on the tape as
current. Machine operations can change it.
The top of the stack in a PDA is not a pointer in any useful sense.
What makes a pointer a pointer per se is that it can be changed to
point to a different object. The top of the stack "points" to only
one thing: whatever is currently on top of the stack. "Changing"
this "pointer" has side effects: it's either a pop, which is a
destructive operation, or a push, which has much more limited
semantics than a "move tape" (or equivalently "move tape pointer")
operation.
Calling the top of the stack a pointer in this sense is uninteresting.
It's equivalent to calling any variable a "pointer". (That a stack
can be implemented with a moving pointer is utterly beside the point.)
--
Michael Wojcik mi************@ microfocus.com
Every allegiance to some community eventually involves such a fetish,
which functions as the disavowal of its founding crime: is not 'America'
the fetish of an infinitely open space enabling every individual to
pursue happiness in his or her own way? -- Slavoj Zizek
Viktor Lofgren <zw*@eudial.n os--pam.mine.nu> scribbled the following: s.subbarayan <s_**********@r ediffmail.com> wrote: Dear all, I had this following doubt,while java is able to carryon with out pointers why C language cant be modified to remove pointer?Hows java able to do this with out pointers? I jus plead sorry to those who advice me to post it to java people because I have already done it. Jus want to know alternatives to pointers which can be used with C.While pointers provide flexibility most bugs are with respect to pointers.So will it not be good if we are able to either forgo the pointers or do some sort of modification(I am not aware how,but it can be considered for research) so that our s/w s are more pure with out bugs?
I am sorry for my amature query,but it will be helpful and I will be thankful to all who makes me understand this.
You got things wrong: Every object is a pointer in Java. You just don't see it. Basic types such as int and short are not pointers. But everything else is.
Your terminology is lax. Objects are not pointers or vice versa. Every
object *variable* is really an object *pointer* variable in Java, but
the things those variables' values point at are real, honest-to-gosh,
all-signing, all-dancing objects. How do you suppose pointers with
nothing to point at could ever be of any use?
--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"Remember: There are only three kinds of people - those who can count and those
who can't."
- Vampyra
Michael Wojcik wrote: In article <cu************ *@zero-based.org>, Martin Dickopp <ex************ ****@zero-based.org> writes:
mw*****@newsg uy.com (Michael Wojcik) writes:
In article <cu************ *@zero-based.org>, Martin Dickopp <ex************ ****@zero-based.org> writes:
Eric Sosman <Er*********@su n.com> writes:
>Malcolm wrote: > >>All computer programs need to address memory (ie use pointers) >>internall y. > > Off-topic nit: Alan Turing demonstrated that this is false.
Even a Turing machine has a "pointer" as a part of its state: the current tape position.
An n-PDA (n > 1) is equivalent to a TM. I don't see any pointer- equivalent in an n-PDA. I would consider a top-of-stack position a pointer.
Sigh. I was going to address this proleptically, then didn't out of laziness.
I can see the argument for calling the current tape position in a TM a "pointer". It marks one of the positions on the tape as current. Machine operations can change it.
Rhetorical question: If you were building a Turing machine,
how many bits would you use to hold the value of this "pointer?"
(Hint: The tape has a countably infinite number of cells.)
Rhetorical question: Since Turing himself allocated zero bits
of his conceptual machine to designate the position of "HERE,"
how many different values can his "pointer" take on? (Hint:
What is the Shannon entropy of a constant signal?)
Calling the top of the stack a pointer in this sense is uninteresting. It's equivalent to calling any variable a "pointer". (That a stack can be implemented with a moving pointer is utterly beside the point.)
Exactly -- just as in the case of "HERE" in a Turing machine.
-- Er*********@sun .com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Neil Zanella |
last post by:
Hello,
Some programmers like to use a coding convention where all names of
variables that are pointers start with the letter p (and sometimes
even use similar conventions for strings and other numeric data
types). Do such programmers also have conventions for naming
structures and unions (e.g. do they like their names to
begin with s and u, so that, when the . operator is
used, it is clear whether a structure or union is
being accessed...
|
by: DirtyClamDigger |
last post by:
Hi Everyone: I'm trying to develop a property list to include as
metadata about my object classes. i.e. I want each class I'm developing
to include a PropertyList which will contain ObjectProperty pointers.
ObjectProperty is a class containing the typeid.name() of a type as
it's ObjectType as well as an ObjectName and ObjectDescription.
Basically 3 strings of metadata describing each of a class' member
variables (and hopefully functions)...
|
by: Scott McFadden |
last post by:
What is the proper way to pass pointers by reference from managed c++ calls
to native c++ calls?
In managed C++, I have a pointer to an array of structures, that I pass to a
native c++ method by reference:
//Managed c++
QueryResult* qr = NULL;
ExecuteQuery(1, "abc", qr); //invoke native c++ method passing qr by
reference
|
by: dbz |
last post by:
Hello everyone. I have a query. Lets say that following is given:-
struct struct1{
char *word;
int n;
} *p;
QUERIES:
What does the following refer to?
|
by: Ivan Liu |
last post by:
Hi,
I'd like to ask if passing an object as an pointer into a function
evokes the copy constructor.
Ivan
| |
by: ajinkya.coep |
last post by:
What's wrong with this program? If you were to fix it, what would the
intended output be?
void swap(char *str, int index1, int index2) {
char tmp = str;
str = str;
str = tmp;
}
int main(int argc, char *argv) {
|
by: madhawi |
last post by:
This question is occur in interview. Please help me.
|
by: ravi |
last post by:
Hi all,
I m relatively new to C. I have few queries related to malloc():
1. When we perform malloc(), the memory allocated dynamically comes from
the heap area of the process in concern. Well, we then say that the heap
has shrinked. my query is: Is it that the heap physically does not
shrink but the perticular nodes are marked 'ALLOCATED' and for
subsequent calls to malloc() the memory manager remembers them and does
not reference...
|
by: Yee.Chuang |
last post by:
When I began to learn C, My teacher told me that pointer is the most
difficult part of C, it makes me afraid of it. After finishing C
program class, I found that all the code I wrote in C contains little
pointers, obviously I avoid using them.
A few days ago when I was reading a book about programming, I was told
that pointers are the very essence of C language, if I couldn't use it
well, I'm a bad programmer, it's a big shock.
So now I'm...
|
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: 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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |