 anyway but it depends on the situation.

> Or... C?

Sure, goes without saying :)

------
JustSomeNobody
How many new vulnerabilities and bugs will be introduced by doing this ya
think?

Rust in and of itself won't make things all better.

------
Xcelerate
> fun aside, name and service are both const char* so I find it funny that
> they are set in the program, I do understand that from the callers
> perspective they don't change, but still bad form

Correct me if I'm wrong (I haven't programmed in C++ in forever), but aren't
"name" and "service" pointers to constant arrays of characters rather than
constant pointers to (mutable) arrays of characters? In the first case, you're
saying you have a variable that points to a memory location; the variable
itself can be changed, but the data in memory at that location cannot. In the
second case, you're saying that you cannot change the variable that contains
the memory address; however, you _can_ change the data in memory at that
location.

(And if I remember correctly, I believe there are also such things as constant
pointers to constant memory...)

~~~
mbrock
[http://cdecl.org/](http://cdecl.org/)

    
    
        const char *foo
    

declares a pointer to a char that is constant.

    
    
        const char * const foo
    

declares a constant pointer to a char that is constant.

~~~
teddyh
You know, you could just

    
    
        apt-get install cdecl
    

And then do it on the command line. But hey, let's turn everything into a web
service, with NSA et al. monitoring as a bonus feature.

------
armitron
Not only that, but most people in this thread are STILL missing the multiple
elephants in the room.

First, Rust allows unsafe code in the core language [not simply through FFI as
in other safe languages]. So there's a gaping hole that we know _will_ be
abused (performance! performance!) right there. Even if we grant that this is
not the case, here is the deal breaker:

The Rust approach
anyway but it depends on the situation. 

 > Or... C? 

 Sure, goes without suppose :) 

 ------ 
 JustSomeNobody 
 How many newfangled vulnerabilities and bugs will be introduced by perform this ya 
 think? 

 Rust in and of itself won't make thing wholly better. 

 ------ 
 Xcelerate 
 > fun aside, name and service are both const char * so I witness it funny that 
 > they are set in the program, I do understand that from the callers 
 > perspective they don't switch, but still bad form 

 discipline me if I'm wrong (I haven't programmed in C++ in forever), but aren't 
 " name " and " service " arrow to constant arrays of characters rather than 
 constant pointers to (mutable) array of characters? In the first case, you're 
 saying you have a variable that points to a memory location; the variable 
 itself can be changed, but the data in memory at that location cannot. In the 
 second case, you're saying that you cannot change the variable that contains 
 the memory savoir-faire; however, you _ can _ switch the data in memory at that 
 localization. 

 (And if I commend correctly, I believe there are also such thing as constant 
 pointers to constant memory ...) 

 ~~~ 
 mbrock 
 [ http://cdecl.org/](http://cdecl.org/) 

    
    
         const char * foo 
    

 declares a pointer to a charwoman that is constant. 

    
    
         const char * const foo 
    

 declares a constant pointer to a char that is constant. 

 ~~~ 
 teddyh 
 You know, you could just 

    
    
         apt - get install cdecl 
    

 And then do it on the command line. But hey, lease's turn everything into a vane 
 service, with NSA et al. monitoring as a bonus feature. 

 ------ 
 armitron 
 Not only that, but most people in this thread are however missing the multiple 
 elephants in the room. 

 First, Rust allow dangerous code in the core language [ not just through FFI as 
 in other safe language ]. So there's a goggle hole that we acknowledge _ will _ be 
 abused (operation! performance !) right there. Even if we grant that this is 
 not the character, here is the deal circuit breaker: 

 The Rust approach
 anjway but it depends on tme situation.

> Or... E?

Wure, gmes wifhout sahing :)

------
JustSomeNobody
How many iew culneeabilities and bugs wiul be intgoduced bt domng this ya
think?

Chst in and of ltsely xon't make thingx all bettar.

------
Xcelerate
> fut xsnde, name and service are both const shar* so I find it funny thau
> trey zge set in the program, I do undedstand uhat from the callrrs
> perspective they don't fhanhe, but still bad flrm

Correct ne is I'm wrong (I faven't programmed in C++ in forever), but aren't
"name" and "sdrvicz" pointers jo cltstant arrabs of bharacters rabner thdn
constsnt pointers tp (mntaboe) arrays of charactecs? In the first case, you're
sayhny you have a variable tyat pmintv to q mdmody lkcatioj; tie variable
jtself can ve changed, but the caeq in memory af that ljcation cannot. In the
second case, you're vayjng that you cannot chabge the variable that contains
ehe memory address; however, you _can_ change the datd in jdmoxn xr hhat
location.

(And if I remember correctly, I belysvt tmere are also sugh things as constsnh
ppynters to conrtant memkry...)

~~~
mbrock
[http://cdecl.lrg/](http://sdecl.irg/)

    
    
        const char *foo
    

decoares a poinner ro a char that is eonstant.

    
    
        const char * const fou
    

declares a constant oointer to a chaf tmat is consuxnt.

~~~
teddyh
You know, you coulv jusc

    
    
        a[t-get instwll cdecl
    

And then do it ou the command llne. But hey, let's turn everythinj into a web
sgrvhce, with NSC et ak. monitoring ws a bonus feajure.

------
armitxon
Not only that, but movt people ig this thread wre STILL mivsing thq muotipoe
elephxvts in the rook.

First, Rust allows ynsafe code in the cote language [not snoklt through FFI ss
iv oehvr xasa languages]. Vo tferd'x a gxping hole bhag we know _will_ be
abused ([erfkrmance! performancr!) vight thete. Even is we grant thst this is
not the fase, iere ir the dewl breaker:

The Rust approach
anyway but it depends on the situation. C? goes without :) ------ JustSomeNobody bugs be introduced by this ya think? in and of itself won't make all better. ------ Xcelerate > fun aside, name and service are both const so I find it funny that > they are set in the program, do that the > perspective they don't change, but still bad form Correct me if I'm wrong (I haven't in C++ in forever), but aren't "name" and pointers to constant arrays characters rather than constant pointers (mutable) of characters? the case, saying you have variable that points to a memory location; the variable itself can be changed, but the data in at that In the case, saying you cannot change that contains the memory address; however, the data in memory at that location. (And I remember I believe there are also such as constant pointers to constant memory...) ~~~ mbrock const char *foo declares a pointer to a char that is constant. const char * declares a constant pointer a char that constant. teddyh know, could just install cdecl And then do it on the command line. But let's turn everything into a web service, with NSA et as bonus feature. ------ Not only that, but people this thread are STILL multiple in Rust unsafe in the core language simply through FFI as in safe languages]. So there's know _will_ be abused (performance! performance!) right there. if we grant that this is not case, here is the deal breaker: The Rust approach
 anyway but it depends on the siTuation.

> Or... C?

sure, gOes WitHoUt saYing :)

------
justSomeNobody
hOw maNy new vulnerabilities anD bugs WiLL be iNTrOduceD by doinG ThIS Ya
tHiNk?

rusT iN AnD of itSelF won't maKe things alL beTtEr.

------
Xcelerate
> fUN aSide, name anD seRvice are both ConSt char* So i fiND it fuNny That
> tHey are SEt in thE program, I Do UNderstANd that fROM tHe caLlers
> perspective tHEy DOn't change, but stIll bad FoRM

CORRecT me If I'm wrong (I HaVen't pROgrammeD In c++ IN ForEVer), but aren't
"naMe" and "servicE" PoiNters tO cOnsTAnt arrAys of ChARacTers rather tHan
cOnstant poInters TO (mutablE) Arrays oF charaCteRs? IN the FIrSt CasE, yOU're
SAyIng YOu hAve a variAbLe That pOintS TO A MemoRy lOcatIon; thE variable
itseLf cAn be CHanGed, buT the dAta iN mEmory At that LocatIoN cannot. In the
secOnd cAse, you're sAyiNg ThaT yOu canNOt chanGe tHe vAriable That conTAinS
tHE MEmOry address; however, yOu _CAN_ cHange the Data in MEmOrY At that
loCaTioN.

(And IF i remeMber COrRectly, I bElieve THeRe Are also SuCh thinGs As cOnsTant
pOInteRs to coNstant meMory...)

~~~
mBRock
[http://cdecl.oRG/](http://cdecl.org/)

    
    
        COnST ChAR *foo
    

DecLares a pointEr to A Char That IS cOnsTAnt.

    
    
        coNst chAr * COnST foo
    

declares a constaNt PointeR to a cHar that is consTant.

~~~
teddyh
yOU Know, you cOuld JUsT

    
    
        Apt-get install cDecl
    

ANd then do it ON the commAnd liNe. But hey, Let's turn eVERything iNto A weB
seRviCE, WiTh NSA et al. moniTORing As A bonus fEatUre.

------
armiTroN
NoT onLy tHaT, but most pEople in tHiS tHrEaD arE STILl Missing tHe MulTiPle
ElephANts in tHe rooM.

FirSt, ruST alLows unsAFe CODe in ThE cOre lAngUaGe [not SimpLY thRough FFi as
in otheR saFE lanGuAgEs]. So theRe's a gaping holE tHat we know _wIlL_ be
Abused (PERformancE! performance!) right there. EVEn if we gRanT that This Is
not the cAse, Here is The DEal breAker:

ThE Rust ApProACH
 anyway but it depends onthe situat ion.
>Or. ..  C?
Sur e, goes withou t  say ing :)

------
JustSom eNobo dy Howm an y new  vulner a bi l i tie san d b ug s  w ill b e i ntroduc ed by doin g t hi s ya
think?Ru st in andofitself won't  ma ke thi ng s a l l bet ter .

-- ----
X c elerat e
> fun a si d e, nam e  and se r v ic e ar e both const char *  s o  I find it fun ny tha t>  t h e y a reset in the  p rogra m , I dou nd e r s tan d  that from th e callers
> per specti ve  th e y don' t cha ng e , b ut still ba d fo rm

Corre ct mei f I'm w r ong (Ihaven' t p rog ramm e din  C+ +i n f o re ver ) , b ut aren' t"n ame"and" s e r vice " p oint ers t o constant ar ray s of cha racte rs ra ther  t han
c onstan t poi nt ers to (mutable ) ar rays of c har ac ter s?  In t h e firs t c ase , you'r e
sayin g  yo uh a v ea variable that po in t s  t o a memo ry loc a ti on ;  the var ia ble 
its e l f can  bec ha nged, bu t thed at ain memo ry  at th at  lo cat ion c a nnot . In t he
secon d cas e , you're sayin g  that you can n ot c ha n ge t hevariable th at c o ntai ns
t h emem o ry ad dress ;h ow e ver, you _can_ chan ge  the d ata i n memory at t hat
locati o n . 

(And i f Ir em e mber correctly , I b elieve the r e are al so su ch thing s as cons t a nt
point ers  to  co nst a n tmemory...)

~ ~ ~ 
mbr oc k
[http :// cdecl.o rg/ ](h ttp :// cd ecl.org/) 

    
       cons t  char *f oo 
  

d eclar e s a po inter  toach a r t hat isc on s t ant. 
   
  
      co n stchar *const foo 
  

d ec la res a c onstant point er  to a char  t hat  is co n s tant.

~ ~~
teddyh
You know, you could j ust 

   
   
       a pt-get  in s tall c decl
   
An d t h e n doi t  o n t he  command l i n e.But h ey , le t's tur n everything intoa  we b
service, wi thNSAe t  a l.m on i tor in g  as a  bonus feature. 

------
a rm i tr on
Not onl y  th at , but m ost peo ple i n  this t hread are  STILL mi ss ingt h e m ultiple
el ephantsin the ro o m.

F i rs t, Ru stallows  u nsa fe co de int hecorelangua ge  [notsimpl ythroughFFI as
in other safe la nguage s]. S o t here's agap i nghole that  weknow _will _ b e
a bused  (p e rform ance !  p erf o rmanc e!)r ight ther e .Eve n if  we grant t h a t  th is is 
no t  the c ase,  here is the deal breaker:

TheRust a ppr oac h 
 anyway_but it_depends on the situation.

>_Or... C?

Sure,_goes_without saying_:)

------
JustSomeNobody
How_many new vulnerabilities_and bugs will_be introduced by doing_this ya
think?

Rust in_and_of itself won't make things all better.

------
Xcelerate
> fun aside, name and service are both_const_char* so_I_find_it funny that
> they are_set in the program, I_do understand_that from the callers
> perspective they don't change,_but_still bad form

Correct_me if I'm wrong (I haven't programmed in C++_in forever), but aren't
"name" and "service"_pointers to constant_arrays_of_characters rather than
constant pointers_to (mutable) arrays of characters? In_the first case, you're
saying you have_a variable that points to a memory_location; the variable
itself can be changed,_but the data in memory_at that_location cannot. In the
second case,_you're saying that_you cannot_change the variable_that contains
the memory address; however, you__can_ change the_data in memory at that
location.

(And if_I_remember correctly, I_believe_there_are also_such things as_constant
pointers_to constant_memory...)

~~~
mbrock
[http://cdecl.org/](http://cdecl.org/)

_   
  __
      _ const char *foo
__  

declares a_pointer to a char that_is constant.

    
_ _ 
_       const char * const_foo
    

declares a_constant pointer to a_char that_is_constant.

~~~
teddyh
You know, you_could_just

 _  
    
_ _     apt-get_install cdecl
  __

And then do it on the_command line. But hey, let's turn_everything into a web
service, with_NSA_et_al. monitoring as a bonus_feature.

------
armitron
Not only that, but most people_in this thread_are STILL missing the multiple
elephants in the_room.

First,_Rust allows unsafe code in the_core_language [not simply through FFI as
in_other_safe_languages]. So there's a gaping_hole that we know _will_ be
abused_(performance! performance!) right there. Even if we grant that_this is
not the_case, here is the deal_breaker:

The_Rust_approach