Christian Seiler: (C / Linux) Richtig debuggen?

Beitrag lesen

Hallo Markus,

files[i] = (File)malloc(sizeof(*File));


>   
> So etwas schrieb ich schon mal, weil ich offensichtlich schon mal auf der richtigen Fährte war. Es lässt sich aber nicht kompilieren, zumindest nicht mit gcc, als welchem Grund auch immer.  
  
Hmm, da habe ich mich vertan, das geht nicht für Typen, sondern nur für Variablen. Im Prinzip kannst folgendes machen:  
  
`files[i] = (File)malloc(sizeof(*(files[i])));`{:.language-c}  
  
Wie gesagt würde ich aber von typedefs auf Pointer \*SEHR STARK\* abraten. Das obige kommt als weiterer Grund, warum man das vermeiden möchte, dazu.  
  
Viele Grüße,  
Christian  

-- 
[Mein "Weblog"](http://del.icio.us/chris_se/servertipps) [[RSS](http://del.icio.us/rss/chris_se/servertipps)]  
[Using XSLT to create JSON output](http://www.christian-seiler.de/projekte/xslt-json/) (Saxon-B 9.0 for Java)  
  
»I don't believe you can call yourself a web developer until you've built an app that uses hyperlinks for deletion and have all your data deleted by a search bot.«  
            -- [Kommentar bei TDWTF](http://thedailywtf.com/Comments/WellIntentioned-Destruction.aspx#254549)