Saturday, January 23, 2010

comp.lang.c - 8 new messages in 6 topics - digest

comp.lang.c
http://groups.google.com/group/comp.lang.c?hl=en

comp.lang.c@googlegroups.com

Today's topics:

* Facing problem even in basic C++ graphics programs compilation!!!HELP - 1
messages, 1 author
http://groups.google.com/group/comp.lang.c/t/fa5155e582ab4965?hl=en
* Philosophical question about C - 2 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/3ccb5249714cce41?hl=en
* more compiler switches - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/8c28b8c8976fe158?hl=en
* Getting the size of a C function - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c/t/dcc5cb3c26da8f6f?hl=en
* OT: Real Programmers drink ... - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/25280f3feeb4a199?hl=en
* Const Problem - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c/t/abba35f10c2cf62c?hl=en

==============================================================================
TOPIC: Facing problem even in basic C++ graphics programs compilation!!!HELP
http://groups.google.com/group/comp.lang.c/t/fa5155e582ab4965?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Jan 22 2010 9:30 pm
From: Keith Thompson


risshahaprma <sharmarishap@gmail.com> writes:
> I made a simple program to draw line but it gives errors.I am not able
> to debug them and feeling frustrated as I canna even get myself
> started for graphics ! When I used the same code in my computer lab it
> worked fine..Plz help..I would really appreciate your response!
>
>
> #include <graphics.h>
> #include <iostream.h>
> #include <conio.h>
>
> int main()
> {
> /* request auto detection */
> int gdriver = DETECT, gmode;
>
> /* initialize graphics mode */
> initgraph(&gdriver, &gmode, "c:/tc/bgi");
>
> /* draw a line */
> line(0, 0, 400, 400);
> getch();
> return 0;
> }
> error 1:undefined symbol _line in module ris.cpp
>
> error 2:undefined symbol _initgraph in module ris.cpp

This is comp.lang.c; comp.lang.c++ is down the hall on the left.

But you'd probably run into the same problem if you were using C, so
I'll try to give you a hint or two.

Neither <graphics.h> nor <conio.h> is a standard header in either
C or C++. They're probably provided by your implementation.
Since your code compiles, you apparently have the headers available
both in your computer lab and wherever else you're trying this (you
didn't say). Errors like "undefined symbol" are typically produced
by the linker, and can indicate that you didn't tell the linker
where to find the required library or libraries. Probably whatever
library is associated with the header <graphics.h> is the culprit.
I don't know how to tell the linker (whichever one you're using)
to load that library (whatever it is); you'll have to find that
out elsewhere, either by reading your system's documentation or by
asking in another forum.

Note that the folks in comp.lang.c++, though they know plenty about
the C++ language, are no more likely than we are to know about this
<graphics.h> header or its associated library.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

==============================================================================
TOPIC: Philosophical question about C
http://groups.google.com/group/comp.lang.c/t/3ccb5249714cce41?hl=en
==============================================================================

== 1 of 2 ==
Date: Fri, Jan 22 2010 9:39 pm
From: Nobody


On Fri, 22 Jan 2010 10:42:24 -0700, BGB / cr88192 wrote:

> dunno about GObject "in general" (not much experience with glib much beyond
> its general refusal to work well on Windows IME...), but did have some past
> experience with GTK.
> I personally like to keep any such hackery behind API lines.
>
> one could argue I guess that the GTK design allows a slightly more efficient
> interface than doing basic checks/casts within the API or within the method
> handlers, since the frontend presumably knows the types "more exactly" (and
> so may avoid any checks), but then again, I have a difficult seeing how in
> this case the slight loss in efficiency can justify the terribleness of the
> API.

Perhaps you should explain exactly what's so terrible about the API?

Personally, I don't consider having to perform explicit up-casts to be an
unbearable burden (down-casts should be explicit anyhow).

> another detail:
> in my designs (typically when doing "OO-ish" stuff in plain C), usually the
> root vtable will contain all of the methods for pretty much all of the
> object sub-types. in this case, usually any unused methods are NULL in
> sub-classes for which they are unused

There's no need for that. Neither GTK+ nor Xt work that way; each class
has class and instance structures which extend the corresponding parent
structures.

== 2 of 2 ==
Date: Fri, Jan 22 2010 9:43 pm
From: Nobody


On Fri, 22 Jan 2010 17:49:53 +0000, Mark wrote:

>>> I was trying to get a reaction, but have you looked at Win32? You
>>> register window classes (they call 'em classes) then instantiate
>>> instances of the class. A windows dispatch function handles messages
>>> sent to the windows class instance (object). Sounds pretty OO to me. X-
>>> Window does similar stuff.
>>
>> Xlib doesn't do any OO; that's left to GUI toolkits (Xt, GTK, Qt).
>
> Actually, I think you could easily construct a reasonable (and reasoned)
> argument that there are OO constructs within the design and implementation
> of X itself. If you can't see objects in Xlib, I suspect you aren't
> looking at it closely enough.

If you define OO that loosely, you would be hard pressed to find something
which *doesn't* fit the definition.


==============================================================================
TOPIC: more compiler switches
http://groups.google.com/group/comp.lang.c/t/8c28b8c8976fe158?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Jan 22 2010 9:55 pm
From: jaysome


On Fri, 22 Jan 2010 18:44:35 -0700, frank <frank@example.invalid>
wrote:

>I've been looking through gcc.pdf for a head-splitting half hour and
>cannot find the command-line switch that tells you what all is defined
>as preprocessing turns into compilation. In my own defense, the
>switches are divided up into preprocessing, compiling, and
>environmental, and this sits on the bubble with all 3.
>
>I certainly noticed the -I switch, which would have saved me a lot of
>grief this week, to say nothing of looking like a buffoon.
>
>TIA

The following works for me.

For gcc on UNIX, Linux, Mac OS X and so on:

gcc -dM -E - < /dev/null

For gcc on Windows:

gcc -dM -E - < /nul

--
jay


==============================================================================
TOPIC: Getting the size of a C function
http://groups.google.com/group/comp.lang.c/t/dcc5cb3c26da8f6f?hl=en
==============================================================================

== 1 of 2 ==
Date: Fri, Jan 22 2010 9:57 pm
From: Paul Keinanen


On Fri, 22 Jan 2010 22:53:18 +0000 (UTC), john <john@nospam.com>
wrote:

>I need to know the size of a function or module because I need to
>temporarily relocate the function or module from flash into sram to
>do firmware updates.

Do you actually want to execute that function while in RAM or just
store some bytes into safety during the update ?

If you intend to execute, the code must be position independent e.g.
with PC relative branch, however accessing some fixed addresses, such
as memory mapped peripherals, some absolute addressing mode must be
used, no PC relative addressing modes can not be used.


== 2 of 2 ==
Date: Sat, Jan 23 2010 12:03 am
From: jacob navia


Mark Borgerson a écrit :
> In article <pan.2010.01.23.05.08.12.672000@nowhere.com>,
> nobody@nowhere.com says...
>> On Fri, 22 Jan 2010 22:53:18 +0000, john wrote:
>>
>>> I need to know the size of a function or module because I need to
>>> temporarily relocate the function or module from flash into sram to
>>> do firmware updates.
>> Do you need to be able to run it from RAM? If so, simply memcpy()ing it
>> may not work. And you would also need to copy anything which the function
>> calls (just because there aren't any explicit function calls in the source
>> code, that doesn't mean that there aren't any in the resulting object code).
>>
>>
> At the expense of a few words of code and a parameter, you could do
>
>
> int MoveMe(...., bool findend){
> if(!findend){
>
> // do all the stuff the function is supposed to do
>
> } else Markend();
>
> }
>
>
> Where Markend is a function that pulls the return
> address off the stack and stashes it somewhere
> convenient. Markend may have to have some
> assembly code. External code can then
> subtract the function address from the address
> stashed by Markend(), add a safety margin, and
> know how many bytes to move to RAM.
>
>
> Mark Borgerson
>

Sorry Mark but this is totally WRONG!

The return address contains the address where the CPU RETURNS TO
when the current function is finished, not the end of the
current function!!!

The return address will be in the middle of another function, that CALLED
this one.

==============================================================================
TOPIC: OT: Real Programmers drink ...
http://groups.google.com/group/comp.lang.c/t/25280f3feeb4a199?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Jan 22 2010 11:33 pm
From: Gareth Owen


raltbos@xs4all.nl (Richard Bos) writes:

> Any Briton, Chinese, Taiwanese or Japanese who prefers coffee to tea
> is doomed to eternal damnation. Any non-Englishman who prefers coffee
> to tea is merely a fool.

As a coffee loving British non-Englishman, I am now mightily confused.
Am I a doubly doomed fool, or do I get a double-negative loophole. :)

==============================================================================
TOPIC: Const Problem
http://groups.google.com/group/comp.lang.c/t/abba35f10c2cf62c?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Jan 22 2010 11:57 pm
From: "io_x"

"io_x" <a@b.c.invalid> ha scritto nel messaggio
news:4b50301b$0$817$4fafbaef@reader5.news.tin.it...
>
> "venkatarao0@gmail.com" <battula.venkat@gmail.com> ha scritto nel messaggio
> news:5c262bec-ae20-4ddf-a021-8e12115e8805@a32g2000yqm.googlegroups.com...
>> Hi Friends,
>> I got problem hear,
>>
>> C++ File:
>>
>> const int val=0;
>> int *ptr = (int *)&val;
>> *ptr = 55;
>> cout<<val<<endl; // out put 0
>> cout<<*ptr<<endl; // out put 55
>>
>> in debugging val & *ptr are showing 55 only,
>> but while printing val it is showing '0' as out put
>> while printing *ptr it is showing '55' as out put
>>
>> what is the problem, i am unable to get could u pls help me out.
>
> repeat with me:
> const very ugly;

bool, _bool, _Bool BOOL very very very ugly

> private protected friend template, ugly;

don't know for template, and friend

> pass by references for one function or operator good;
> references like alias ugly;
> pointers good;
> classes good;
> constructor/distrctor very good;
> malloc/free good;

> C++ library seems ugly;
> C library seems ugly;
> C and C++ (operator, overloading too) languages very good;
> assembly languge [or base language] very good;

==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.c"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.c?hl=en

To unsubscribe from this group, send email to comp.lang.c+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.c/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate