Click here to Skip to main content
15,891,943 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to convert Chinese Unicode string to ANSI multibyte? Pin
tmx24-Mar-10 21:47
tmx24-Mar-10 21:47 
QuestionReg MDI windows Explorer Pin
hellogany22-Mar-10 20:45
hellogany22-Mar-10 20:45 
AnswerRe: Reg MDI windows Explorer Pin
Richard MacCutchan22-Mar-10 22:16
mveRichard MacCutchan22-Mar-10 22:16 
AnswerRe: Reg MDI windows Explorer Pin
Adam Roderick J23-Mar-10 2:19
Adam Roderick J23-Mar-10 2:19 
GeneralRe: Reg MDI windows Explorer Pin
hellogany23-Mar-10 18:40
hellogany23-Mar-10 18:40 
GeneralRe: Reg MDI windows Explorer Pin
hellogany28-Mar-10 20:15
hellogany28-Mar-10 20:15 
QuestionGCC Linker and Where To Define Structures Pin
Trevor Johansen22-Mar-10 17:46
Trevor Johansen22-Mar-10 17:46 
AnswerRe: GCC Linker and Where To Define Structures Pin
CPallini22-Mar-10 21:55
mveCPallini22-Mar-10 21:55 
Trevor Johansen wrote:
I know that the compiler is invoked for every separate c file so it will include say function _delay() in every .c file. The linker then puts all the objects together and makes the binary but does it strip the duplicate _delays?? I know the pragma once and other inclusion guards are only relative to that source file being compiled and each source will include the functions.

There is no need to strip the duplicates because there aren't actually duplicate functions (you may include the function declaration in all C source files, provided the function definition -i.e. the function body- is in just one source file).

Trevor Johansen wrote:
declared in my header and want to use these states in multiple source files so I include the header when I need it. I also have an initialized structure struct branch the_table[8][5] = { {Control,0,0,0,0,0}, {Speed,0,0,0,0,0} }; and since this structure is using memory I must put it in my source file the problem is I want to be able to access this array outside of its source file and if I declare extern truct branch the_table[8][5]; in the header with the rest of the structure decelerations other source files cannot access its internal structure.


That's the correct way to do it: define the structure in one source file and made it available to other source files using the extern declaration.

As far as you use the #pragma once (do GCC recognize it?) directive (or the oldie-goldie #ifndef...) to avoid multiple inclusions, I see no problem in your approach.
Smile | :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

GeneralRe: GCC Linker and Where To Define Structures Pin
Trevor Johansen24-Mar-10 9:22
Trevor Johansen24-Mar-10 9:22 
GeneralRe: GCC Linker and Where To Define Structures Pin
CPallini24-Mar-10 11:33
mveCPallini24-Mar-10 11:33 
GeneralRe: GCC Linker and Where To Define Structures Pin
Trevor Johansen25-Mar-10 13:08
Trevor Johansen25-Mar-10 13:08 
GeneralRe: GCC Linker and Where To Define Structures Pin
CPallini25-Mar-10 21:41
mveCPallini25-Mar-10 21:41 
QuestionHow do you display a bitmap in IE and control navigation? Pin
nstein222-Mar-10 11:57
nstein222-Mar-10 11:57 
AnswerRe: How do you display a bitmap in IE and control navigation? Pin
KarstenK23-Mar-10 4:21
mveKarstenK23-Mar-10 4:21 
QuestionDeleting a single point from a quadtree Pin
Chidori-chan22-Mar-10 9:43
Chidori-chan22-Mar-10 9:43 
AnswerRe: Deleting a single point from a quadtree Pin
Avi Berger22-Mar-10 11:00
Avi Berger22-Mar-10 11:00 
AnswerRe: Deleting a single point from a quadtree Pin
Richard MacCutchan22-Mar-10 11:07
mveRichard MacCutchan22-Mar-10 11:07 
QuestionRe: Deleting a single point from a quadtree Pin
Chidori-chan23-Mar-10 8:52
Chidori-chan23-Mar-10 8:52 
QuestionRST Template Matching Pin
cherrymotion22-Mar-10 6:20
cherrymotion22-Mar-10 6:20 
AnswerRe: RST Template Matching Pin
Tim Craig22-Mar-10 9:45
Tim Craig22-Mar-10 9:45 
GeneralRe: RST Template Matching Pin
cherrymotion22-Mar-10 11:05
cherrymotion22-Mar-10 11:05 
GeneralRe: RST Template Matching Pin
Tim Craig22-Mar-10 13:48
Tim Craig22-Mar-10 13:48 
GeneralRe: RST Template Matching Pin
cherrymotion23-Mar-10 11:18
cherrymotion23-Mar-10 11:18 
GeneralRe: RST Template Matching Pin
Tim Craig23-Mar-10 12:53
Tim Craig23-Mar-10 12:53 
GeneralRe: RST Template Matching Pin
cherrymotion25-Mar-10 6:46
cherrymotion25-Mar-10 6:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.